Boost logo

Boost :

From: Daniel Spangenberg (dsp_at_[hidden])
Date: 2003-10-21 06:18:10

Hello, Eugene Gladyshev!

"E. Gladyshev" schrieb:

> Another problem with the cross process implmentation is
> where do you put the read counter? It has to be shared
> across your processes.
> You could use the shared memory by declaring it with
> #pragma data_seg ( ".sdata" ) but it may be tricky.
> If one of the read processes terminates unexpectedly,
> the counter may never go to zero.
> The same is actually true for threads.
> If a thread that has a read access exits
> unexpectedly, the counter may not decremented.
> In the case of the system mutex, the OS takes
> care of releasing the mutex that has been
> locked by the crashed process/thread.
> In particular, the wait function will
> Here is how Win32 describes this code.
> "The specified object is a mutex object that was not released by the thread that owned the mutex
> object before the owning thread terminated. Ownership of the mutex object is granted to the
> calling thread, and the mutex is set to nonsignaled."
> You would need do something similar for you read counter,
> that without a built-in OS support, could be quite tricky.

I also think so concerning the nature of the read counter. It seems, that under Win32 the
shared memory (via the usage of CreateFileMapping/MapViewOfFile) seems to be the adequate
choice. Does anyone has another opinion concerning this?

Thanks for all contributions,


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