On 07.09.2013 10:46:18, Samuel Thibault wrote: > Marin Ramesa, le Sat 07 Sep 2013 10:17:29 +0200, a écrit : > > We have a local variable mqueue that is set by the lock, but if you > > look at the definition of imq_unlock() and then simple_unlock() > > members of mqueue just change state and they don't have any effect > > on any other variable, > > Sure, that is what usually happens for a locking/unlocking primitive > pair: its only purpose is to change the state of the lock, and the > side effect is obtained simply because other portions of the code use > the same lock (imq_lock), to protect the same thing (the seqno). > > > plus it's a local variable - I would understand the code if > > mqueue is more global, but it's not. > > The local variable is simply used to store the queue associated with > the port, in order to be able to unlock it.
I completely misunderstood the code and the simple locks. No patch is needed and there is no real bug. Sorry if I have taken up your time. My misunderstanding and GCC (ver. 4.7.2) set-but-unused warning about mqueue got me thinking that there's no real locking happening when MACH_SLOCKS is not defined. Also, thanks for the above quoted explanation.