
Ada multitasking with X-windows
Quote:
>Subject: How do you (or would you) implement fork() in Ada???
>Organization: Wright State University
>Disclaimer: All views are my own, and do not reflect the views of SAIC.
>>TASKS ARE NOT THE ONLY WAY OF ... CONCURRENT ADA PROGRAMS
>Because our group is having a little X-Ada-Unix program in the making,
>we have the need for another approach. So, I thought of asking help
>from people who know alot about Ada.
>Heres the problem:
>A 'callback' is added to a button (X Window System). This callback
>is an Ada procedure. It must do slow SQL things. We do not want the
>GUI to wait for this to complete. Instead, we want (through some
>mechanism in Ada) the procedure, task or ???? to do its thing, and
>then send raise an event 'got_SQL_stuff_event' to the GUI.
>In 'C' you could do a fork with the parent not waiting for the
>child to finish.
>Insights, thoughts, criticisms are welcomed, encouraged but will not
>be paid for except by our undying gratitude!
>Marci Khader
>SAIC
X/Ada developer BEWARE!
The current release(s) of X are *NOT* re-entrant (R4 and R5). There
*is* locking macros in the source, but they are incomplete and the
chances are that you're implementation uses the default null macros
anyways.
Xt is even less re-entrant. In fact, Xt will never be re-entrant in
it's current design.
Motif is no more re-entrant (indirectly in part because Xt is not re-entrant).
In other words, multi-threaded applications which have more than 1
thread accessing Xlib, Xt, or any other toolkit layered upon Xt are
faulty programs.
See numerous previous discussions on comp.lang.x and previous
discussions here on comp.lang.ada...
Not to fret, however:
It *IS* possible to develop multi-threaded X/Xt/Motif applications,
but you have to design for it from the start. Only 1 task gets to do
GUI stuff at a time, but *you* provide the necessary serialization.
There are a couple of published methods on how to do this.
NOTE: This means more than building a non-blocking event dispatch
loop!
IMHO, it is really the task of bindings vendors to develop and maintain
such tasking safe bindings.
I talked to Scott Cleveland at SERC, and he says that SERC is working on
a tasking safe bindings for the next release of SA-Motif.
ATC owes me a call, but I haven't heard back. Anyone from ATC reading this ?
What's the word ?
John Goodsen
--
X-miester SETT, Inc. (an affiliate of EVB Software Engineering)