diff options
author | Pixel <pixel@nobis-crew.org> | 2012-04-03 09:30:58 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2012-04-03 09:30:58 -0700 |
commit | 532f3e7bae955f8da4c2028bc462134ed10ff414 (patch) | |
tree | 239b1dfc5cf4694cfba375d1306dc8bbe2b5b4b8 /src/Task.cc | |
parent | 37221dc091725c6fea09181b845308ab8f26c795 (diff) |
Slightly more change to the Queue system, so Debug mode doesn't freak pout.
Diffstat (limited to 'src/Task.cc')
-rw-r--r-- | src/Task.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/Task.cc b/src/Task.cc index 1486540..644e302 100644 --- a/src/Task.cc +++ b/src/Task.cc @@ -235,7 +235,7 @@ void Balau::Task::yield(Events::BaseEvent * evt, bool interruptible) throw (Gene } } -void Balau::QueueBase::iPush(void * t) { +void Balau::QueueBase::iPush(void * t, Events::Async * event) { ScopeLock sl(m_lock); Cell * c = new Cell(t); c->m_prev = m_back; @@ -244,20 +244,22 @@ void Balau::QueueBase::iPush(void * t) { else m_front = c; m_back = c; - pthread_cond_signal(&m_cond); - m_event.trigger(); + if (event) + event->trigger(); + else + pthread_cond_signal(&m_cond); } -void * Balau::QueueBase::iPop(bool wait) { +void * Balau::QueueBase::iPop(Events::Async * event) { ScopeLock sl(m_lock); while (!m_front) { - if (wait) { - pthread_cond_wait(&m_cond, &m_lock.m_lock); - } else { - Task::prepare(&m_event); + if (event) { + Task::prepare(event); m_lock.leave(); - Task::yield(&m_event); + Task::yield(event); m_lock.enter(); + } else { + pthread_cond_wait(&m_cond, &m_lock.m_lock); } } Cell * c = m_front; |