[comp.windows.x] query: multi-threaded use of X by Ada tasks

bertrand@cui.unige.ch (IBRAHIM Bertrand) (05/02/89)

     I am working on a computer aided learning project at the University 
of Geneva using the X-windows Xray toolkit with an ADA interface on a SUN 3/60 
workstation.  I'm having a problem with multi-threaded access to the toolkit
and low-level X windows primitives.
     My ADA program has several tasks which call into the Ada interface to Xrlib
which, in turn, calls the toolkit's C routines.  Everything worked fine until I 
put a call to XGet_Geometry() into one of the tasks.  This caused the window 
manager to hang and anonymous run-time error to appear:  "sequence lost."
     I could make everything fine again by embedding the XGet_Geometry() call
inside an ADA "rendezvous", thus suspending the other tasks for the duration
of the call.  I could also make it work by surrounding all toolkit calls with
"Wait" and "Signal" calls to a semaphore task, thus confirming that the 
toolkit won't support multi-threaded access.
     The C code for each X Windows primitive locks and unlocks the display with
the macros "LockDisplay" and "UnlockDisplay" which, in my copy of the X Windows
source, are empty macros which do nothing.  The manual says that these macros
can be defined for systems which want to support multi-threaded access.
     My question is how can I make the Xray toolkit and the low-level
X Windows primitives support multi-threaded access?  How are "LockDisplay" and
"UnlockDisplay" supposed to be implemented?  (The C code can't possibly know
about ADA tasks.)  Is there anyone else using the ADA interface who has 
encountered this problem?  I would appreciate any suggestions or comments.

I am using X11R2 on a Sun 3/60 running SUNOS3.5. The release of the Xray toolkit
is the one that arrived with the X11R2 tapes.

Thanks for any help.

Bertrand Ibrahim
              to BITNET                             to MHS
from
BITNET   IBRAHIM@CGEUGE51                 ibrahim@uni2a.unige.ch
INTERNET IBRAHIM%CGEUGE51@CUNYVM.CUNY.EDU ibrahim%uni2a.unige.ch@ubc.csnet
MHS                                       ibrahim@uni2a.unige.ch
JANET                                     ibrahim%uni2a.unige.ch@uk.ac.ean-relay
from UUCP to UUCP : cernvax!cui!bertrand.uucp
                    mcvax!cernvax!cui!bertrand.uucp
                    cui!bertrand@cernvax.UUCP