Boost logo

Boost :

Subject: Re: [boost] [Interprocess] Experimental Win32 Mutexes
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2012-12-13 18:40:23


El 11/12/2012 15:46, Brink, Robert (GE Aviation, US) escribió:
> However, we are seeing some debug asserts pop up. I'm not 100%
> positive what causes it, but it seems that as we scale up our system
> we tend to get tripped up by the assert in
> boost\interprocess\sync\windows\mutex.hpp, Line 61. It appears that
> when we create the mutex, we are getting an "already exists" winapi
> error. Looking at the windows documentation this seems to be given
> if the mutex already exists, but the mutex is returned anyways. The
> commentary in the boost code indicates that it wants a mutex to be
> created and not opened, but I'm not sure why that is.

When the shared memory mutex constructor is called, a new named mutex is
created with a unique name (based on a timestamp), so no other mutex
should exist with that name.

I see that in sync_utils.hpp's obtain_mutex() function popen_created is
initialized to true when mutex is created or opened, but I think there's
a bug as it's never assigned false when the mutex already exists. Maybe
a previous garbage value can cause problems. Try to add

       else if(popen_created){
          *popen_created = false;
       }

to obtain_mutex() and obtain_semaphore() functions in ync_utils.hpp to
see if it helps.

Best,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk