got all of the code to actually compile again
I don't think it actually works though.
diff --git a/aos/atom_code/ipc_lib/condition.cc b/aos/atom_code/ipc_lib/condition.cc
index 1524773..f65c67d 100644
--- a/aos/atom_code/ipc_lib/condition.cc
+++ b/aos/atom_code/ipc_lib/condition.cc
@@ -6,49 +6,23 @@
namespace aos {
+static_assert(shm_ok<condition_variable>::value,
+ "all C structs really should work in shared memory");
static_assert(shm_ok<Condition>::value, "Condition should work"
" in shared memory");
-Condition::Condition() : impl_(0) {}
+Condition::Condition(Mutex *m) : impl_(), m_(m) {}
-bool Condition::Wait() {
- switch (condition_wait(&impl_)) {
- case 1:
- return false;
- case 0:
- return true;
- default:
- if (errno != EINTR) {
- LOG(FATAL, "condition_wait(%p(=%"PRIu32")) failed because of %d: %s\n",
- &impl_, impl_, errno, strerror(errno));
- }
- return false;
- }
-}
-bool Condition::WaitNext() {
- switch (condition_wait_force(&impl_)) {
- case 1:
- return false;
- case 0:
- return true;
- default:
- if (errno != EINTR) {
- LOG(FATAL, "condition_wait_force(%p(=%"PRIu32")) failed"
- " because of %d: %s\n", &impl_, impl_, errno, strerror(errno));
- }
- return false;
- }
+void Condition::Wait() {
+ condition_wait(&impl_, &m_->impl_);
}
-void Condition::Set() {
- if (condition_set(&impl_) == -1) {
- LOG(FATAL, "condition_set(%p(=%"PRIu32")) failed because of %d: %s\n",
- &impl_, impl_, errno, strerror(errno));
- }
+void Condition::Signal() {
+ condition_signal(&impl_);
}
-void Condition::Unset() {
- // can not fail
- condition_unset(&impl_);
+
+void Condition::Broadcast() {
+ condition_broadcast(&impl_);
}
} // namespace aos