Subject: Re: pthreads, Xlib and me ...
To: Bill Stouder-Studenmund <wrstuden@netbsd.org>
From: leon zadorin <leonleon77@gmail.com>
List: port-macppc
Date: 03/28/2007 15:38:01
On 3/28/07, Bill Stouder-Studenmund <wrstuden@netbsd.org> wrote:
> I know very little about X, but aren't you supposed to be calling
> XLockDisplay at points?

mmm... I was under the impression that it would only be needed if a
given pointer to  Display (as obtained from XOpenDisplay) was accessed
from multiple threads... now, since (in my sample) the XOpenDisplay
returns a pointer which is only being accessed from the very thread
that called XOpenDisplay, then AFAIK one does not need to call
XLockDisplay...

I mean the very signature of XLockDisplay takes a pointer to Display
which is to be locked: "The XLockDisplay() function locks out all
other threads from using the specified display"...

In other words, my understanding is that if different threads use
XOpenDisplay and do not "cross-touch" the Display pointers (returned
by their respective XOpenDisplay calls) then there is no need to call
XLockDisplay...

In my sample, there was only 1 thread which did both: called
XOpenDisplay and accessed it (via  glXQueryExtension and
glXQueryVersion)...

But I would welcome more info or arguments on this subject :-)