A method of integrating an Xt Intrinsics based toolkit with a JAVA application.
The application includes a process thread that implements an X event loop and an
application thread that suspends execution of the event loop to allow a call to
be made through the JAVA Native Interface to a toolkit or a widget to cause something
to be displayed. The application thread includes a write socket to communicate
a token to a read socket of the event loop, and performs a blocking read suspending
the thread. The event loop returns an acknowledgment token via a write socket to
a read socket of the thread that unblocks its blocking read and the event loop
invokes its own blocking read suspending its execution. The file descriptor function,
XtAppAddInput, preferably, is used to read the token and to set the blocking read.
After a toolkit call is made, a token is sent from a second write socket of the
thread to a second read socket of the event loop that unblocks its blocking read
resuming the event loop. JAVA multithreading support services, such as JAVA's wait
and notifyAll methods, are employed in multithreaded applications to ensure that
only one thread at a time can make a call. Use of a separate Intrinsics application
context to service the event loop is employed, windows are managed in separate
hierarchies associated with each application context, and a special JAVA Canvas
manages native windows transparent to the programmer.