Boost logo

Boost :

Subject: [boost] [Interprocess] message_queue should use timed_lock
From: Hartmut Kaiser (hartmut.kaiser_at_[hidden])
Date: 2012-12-05 14:23:49


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)))

(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

Boost list run by bdawes at, gregod at, cpdaniel at, john at