[wx-dev] wxGTK wxMutexGuiEnter vs. gdk_threads_enter

Paul Cornett pc-wx at bullseye.com
Mon Jan 15 11:47:22 PST 2007


Stefan Neis wrote:
>> the GTK threading system provides an exact counterpart to our
>> wxMutexGuiEnter()/wxMutexGuiLeave() in
>> gdk_threads_enter()/gdk_threads_leave(). I think for better
>> integration with GTK, our wxMutexGuiEnter/Leave should be implemented
>> to call gdk_threads_enter/leave, rather than using our own mutex. I
>> have tried it out and it seems to work. Does anyone see a problem with
>> doing this? 
> 
> Only that it will add an #ifdef in what currently is common Unix code
> (isn't it?) shared between wxX11, wxMotif and wxGTK(1 & 2). And for
> exactly what benefit? ATM it sounds like a "useless" code uglification
> (at least to me), but of course I might easily be missing something.

Well, I would say that doing it right is not "useless".

Its true that the simplest change would probably add 2 #ifdefs to 
threadpsx.cpp, but it already has more than 30, so don't make it sound 
like this would make it ugly. Just 7% uglier. And, IMHO, its kinda ugly 
that a base file has GUI-only code in it in the first place.

Having 2 different locks for the same purpose, used in different places 
(one of which is unintentionally disabled), is screwy. I think making it 
coherent is worth the added bit of ugly.




More information about the wx-dev mailing list