apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Massimo Manghi <mxman...@apache.org>
Subject global mutex lock waits forever
Date Wed, 09 Mar 2011 09:54:48 GMT
I'm perhaps not very polite asking on this list without
waiting the usual lurking time, but I've been googling
this problem for a while yesterday and I did not find out
anything about it. Still the problem is very clear:

I wrote a sort of 'hello world' program where a global
mutex is created to synchronize access to a resource
shared between a parent and a child process created with a
Unix 'fork' call.

The child *should* gain the lock first, as the parent is given
a 2 seconds wait before attempting to lock the mutex. Then
it should release the lock giving way to the parent. That's all.
Simply the calls to apr_global_mutex_[lock|trylock|unlock]
wait forever and never return.

I also thought the apr_global_mutex_create returned an implicitly
locked mutex and tried to unlock it. Also this call would block
forever. Where did I get it wrong?

I asked also other people who are using global mutexes in
their projects and they observed the same problem when they
run my program and could not give an explanation.

The program is so simple that I dare attach it here. It is
a way to become familiar with tools that I hope will be used to
design and implement a new software component to be developed
for Apache Rivet, if this can work as an excuse for my

thanks for any help.

  -- Massimo Manghi

View raw message