Double lock on wxMutex(wxMUTEX_DEFAULT) allowed?

Koen Vermeer koen at vermeer.tv
Tue Oct 2 01:08:25 PDT 2007


Hi Vadim,

On Sun, 2007-09-30 at 00:38 +0200, Vadim Zeitlin wrote:
>  Unfortunately not only Win32 mutexes are recursive by default but, in
> fact, they're *always* recursive. I hoped we'd be able to detect recursive
> calls to Lock() at least in debug mode (i.e. with some overhead) but I
> don't know of any way to do it using Win32 API. If anybody does, it would
> certainly be great to hear about it.

I see. The way I read the documentation, it says that a wxMutex is not
recursive by default. I cannot find any comment on wxMSW specific
behavior.

The documentation also says:

The reason for this is that recursive mutexes are not supported by all
Unix flavours and, worse, they cannot be used with wxCondition.

Does this mean that wxCondition isn't working as expected on wxMSW?

Then, the next question is obviously how to work around this. I can
think of several ways, but they may all fail if the documentation isn't
accurate. (Please note: I'm not saying this out of anger, it's just a
consideration.)

Koen





More information about the wx-users mailing list