fixed some bugs
The API for the condition variables was broken, so I changed that and
then fixed RawQueue to use it correctly. I also found a bug in the
condition variable implementation using the tests.
diff --git a/aos/common/mutex_test.cpp b/aos/common/mutex_test.cpp
index 7a5c2ce..d9327a1 100644
--- a/aos/common/mutex_test.cpp
+++ b/aos/common/mutex_test.cpp
@@ -59,12 +59,13 @@
}
EXPECT_TRUE(test_mutex.TryLock());
}
+
TEST_F(MutexTest, MutexUnlocker) {
test_mutex.Lock();
{
aos::MutexUnlocker unlocker(&test_mutex);
// If this fails, then something weird is going on and the next line might
- // hang.
+ // hang, so fail immediately.
ASSERT_TRUE(test_mutex.TryLock());
test_mutex.Unlock();
}
@@ -122,6 +123,7 @@
};
int MutexFairnessWorkerThread::cyclesRun;
int MutexFairnessWorkerThread::totalCycles;
+
// Tests the fairness of the implementation. It does this by repeatedly locking
// and unlocking a mutex in multiple threads and then checking the standard
// deviation of the number of times each one locks.