[Interprocess] message_queue should use timed_lock

Hey, I'm running into a timing issue with interprocess::message_queue even when I use the timed send and received functions: One end: if (!mq_->timed_receive(&msg, sizeof(msg), recvd_size, priority, boost::get_system_time() + boost::posix_time::milliseconds(1))) { // ... return false; } // ... The other end: while (!mq_->timed_send(&msg, sizeof(msg), 0, boost::get_system_time() + boost::posix_time::milliseconds(1))) { break; } (mq_ is a shared_ptr<message_queue>) here both ends sit forever inside the timed_receive/timed_send function, both waiting to acquire a lock (ipc/message_queue.hpp, lines 702 and 799), which is held by a third participating process. Shouldn't this lock be using a timed_lock to allow to maintain the API post condition (i.e. returning after the given amount of time in any case)? Regards Hartmut --------------- http://boost-spirit.com http://stellar.cct.lsu.edu

El 05/12/2012 20:23, Hartmut Kaiser escribió:
(mq_ is a shared_ptr<message_queue>)
here both ends sit forever inside the timed_receive/timed_send function, both waiting to acquire a lock (ipc/message_queue.hpp, lines 702 and 799), which is held by a third participating process. Shouldn't this lock be using a timed_lock to allow to maintain the API post condition (i.e. returning after the given amount of time in any case)?
Unless there is a bug (and this seems a bug), the internal lock is only hold to test queue internals and released on the condition variable if blocking is needed, so no process should be blocked on the mutex forever. Ion
participants (2)
-
Hartmut Kaiser
-
Ion Gaztañaga