[wx-dev] Re: Re[2]: regression with event handing in wxBase (unix)

ATS asteinarson at gmail.com
Thu Mar 27 08:38:39 PDT 2008


> > When I had this problem I spent some time looking at the logic around
> > it. I found one minor locking glitch:
> >
> 
> Thanks very much for this information. I've patched trunk with your changes 
> and problem goes away. I attached my changes as a patch to bug 
> https://sourceforge.net/support/tracker.php?aid=1925946

Good to hear.

> > one global sync object (protecting wxPendingEvents list). I think
> > just the global one would be enough. It's hard for me to see the need
> > for more fine grained locking than that.
> 
> Yes, when AddPendingEvent is called wxEvtHandler::m_pendingEventsLock is not 
> very usable, because global wxPendingEventsLocker has to be locked anyway. 
> Having 5 threads that receive data from network and pass that data using 
> events will cause those threads to waste lot of time waiting for 
> wxPendingEventsLocker lock.

I as thinking to have only one global mutex and then use that one to 
protect each wxEvtHandler also. Agreably, if several threads wanted to 
add pending events to _different_ wxEvtHandlers, this would cause more 
blocking than needed. Some benchmark for that approach would be 
interesting as well.

Otherwise, it seems that both objects are needed. Adding / removing 
checking a global list is difficult to do without a shared sync object 
for it.


Regards
// ATS. 




More information about the wx-dev mailing list