Boost logo

Boost Users :

Subject: Re: [Boost-users] [Interprocess] hang locking p_hdr->m_mutex
From: David Byron (dbyron_at_[hidden])
Date: 2011-08-19 19:57:41


On 8/19/2011 4:43 PM, Ion Gaztañaga wrote:
> El 20/08/2011 0:54, David Byron escribió:
>> I've got my machine (Win 7) into a state where using a message queue
>> results in a hang. More specifically, calls to:
>>
>> scoped_lock<interprocess_mutex> lock(p_hdr->m_mutex);
>>
>> hang forever.
>
> For now, the only thing you can do is using a timed lock, It's not easy
> to support robust mutexes when using emulated process-shared resources.

Except that the above code is in message_queue.hpp even in try_send or
timed_send. It's in get_num_msg() for example. So short of modifying
message_queue.hpp I'm not sure what to do.

One thing that came to mind is always calling message_queue::remove on
startup. I think that gets passed this problem, but may introduce some
other complications if the two processes that use the message queue
start and end at undefined times in an undefined order. I'm still
trying to test this, but perhaps you can help by answering this question:

If a process is waiting for the mutex like this:

scoped_lock<interprocess_mutex> lock(p_hdr->m_mutex);

what happens if another process removes the message queue?

Thanks for your help.

-DB


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net