Boost logo

Boost Users :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2006-05-25 01:07:32

> Here is some rough code that may better explain what I'm trying to do:
> (...)
> come code
> (...)

Logically the code seems good, but the problem is that shared_condition
is only limited to work with shared_mutex. The shared_timed_mutex
suffers the same limitation as boost::mutex (I basically ported the code
from inter-thread to inter-process). This is because in
boost::timed_mutex and boost::shmem::shared_timed_mutex the mutex is
imitated with a condition variable + a mutex + a boolean and there is no
real pthread_mutex_t to share with condition variable.

Looking for boost::thread's documentation:

template<typename ScopedLock>
   bool timed_wait(ScopedLock& lock, const boost::xtime& xt);

Requires: ScopedLock meets the ScopedLock requirements.
Effects: Releases the lock on the mutex object associated with lock,
blocks the current thread of execution until readied by a call to
this->notify_one() or this->notify_all(), or until time xt is reached,
and then reacquires the lock.
Returns: false if time xt is reached, otherwise true.
Throws: lock_error if !lock.locked()

So you can only use scoped_lock and no scoped_timed_lock. I will try to
include this in the next documentation.



Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at