Threads, threads, threads

Threads, threads, threads

Post by Rich Neitz » Thu, 26 Jan 1995 06:37:11

Well, I solved some of my problems with X11R6 & Solaris 2 threads, having
belatedly discovering XInitThreads() & the related lock/unlock functions.
However I still cannot get XNextEvent() to work correctly. I have 2 threads,
one blocks on a semaphore & the other on XNextEvent(). When the data
thread is done the XNextEvent() thread should kick in if an event is
waiting, but it doesn't do so consistently. I've been reduced to spinning
on XPending(), which largely defeats the purpose of the multithreading. Is
there a reason that XNextEvent() isn't thread safe? From what I can make
out from the source it will ultimately use either select() or poll() to
block & both are supposed to be thread safe in Solaris 2.

A second problem seems to be that thr_yield() doesn't seem to actually do
anything. If the data thread yields when done the XNextEvent() (or the
kludged XPending()) thread doesn't get the processor, even when it is at a
higher priority. I'm reduced to suspending the data thread so that the
other can check for user input & then restart it if there is none. What
could be happening that prevents the yield from allowing the other thread
to start?


National Center For Atmospheric Research        lokkar borni under sole-vegg
Box 3000 Boulder, CO 80307-3000                 Gj?'i med sitt shinn
303-497-2057                                    jagar borni inn.


Threads, threads, threads

Post by Edward Avil » Sat, 28 Jan 1995 12:49:39

While on the subject, are there any free (gcc?) tools out there
for threads? I'm interested in at least a compiler and de*.