Re: [AD] proposal: remove XLOCK/XUNLOCK

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sun, 2006-04-23 at 14:31 -0700, Chris wrote:

> > Yes, true. If XLockDisplay actually is needed, then we can't remove
> > XLOCK/XUNLOCK. But to me it looks like "XLockDisplay" or something else
> > is always called by X11, and in case XInitThreads was not called, it
> > does the check for "async reply", otherwise it uses a pthreads mutex.
> 
> IIRC, we originally were using XLockDisplay/XUnlockDisplay, but you suggested 
> using pthread mutexes since it seemed to do the same thing and was probably 
> more lightweight.

Well, because it didn't crash. I assume, it is very slightly more
overhead, since XLockDisplay always is called (to do the async reply
check if nothing else) - so our pthreads locks are just done
additionally.

>  I still say we should be using X's lock/unlock functions 
> instead of pthread's mutexes since you can't really know if X may have its 
> own threads trying to run functions on our display, in which case we'd need 
> to use X's locking mechanisms or risk it interupting and causing an async 
> error.
> 

Yes, I completely agree. It just would be so nice to not need
XLOCK/XUNLOCK anymore at all, just because they seem error prone - the
truth is, I'm almost sure there may still be cases inside Allegro's code
where we forgot to lock. And if we would have kept using XLockDisplay,
all the cases that were fixed in the meantime would not have been fixed.

But well, if the locking is needed, there's nothing that can be done
anyway.

-- 
Elias Pschernig





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/