From: kettering@addvax.llnl.gov (Brett 'Volleyball Is My Game' Kettering)
Newsgroups: fj.mail-lists.x-window
Subject: Re: Ada multitasking with X-windows
Date: 7 Apr 92 10:20:38 GMT
Distribution: fj
Organization: Lawrence Livermore National Laboratory

Date: 6 Apr 92 23:01:00 GMT
Message-Id: <6APR199216012569@addvax.llnl.gov>
Newsgroups: comp.windows.x

From Tom's message:

>Well, yes, it *is* that simple, *because* you would have a different version
>of Xlib. You would be using some sort of Ada bindings to Xlib, and any
>decent set of bindings would have to be doing quite a bit more than just
>making sure the arguments pass correctly to the equivalent 'C' library
>routines.

I guess we have a difference of interpretation as to what a binding is.  I
interpret a binding to be something that allows me to call code, written
in a foreign language (non Ada that is here), in my Ada program.  That means
a spec with a bunch of "pragma IMPORT_VALUED_PROCEDURE", "pragma INTERFACE",
etc.  What you describe is another implementation, according to my definition
of implementation vs. binding.  I have only used the X implementations on
DEC/VMS and the Sun SPARC.  I have only used Ada on the DEC/VMS platform
with DEC's binding.  I know that if you call XNextEvent or XtAppMainLoop with
DEC`s binding your process delays forever (well until another X event comes
along) and does not allow the Ada RTS to take over and schedule another task
because the process never gets back on the CPU.

>This is how it maintains control over the tasks. In
>an Ada binding to "select", for instance, the RTS would remember that
>this *task* wants to do a select, but may give another task the
>opportunity to run.

It can't give another task a chance to run if the RTS itself cannot run.

>And in an Ada binding to "XNextEvent", a similar
>thing would occur. The Ada RTS is in some ways a mini-kernel. And,
>as such, it must be "between" X and Unix, just as X must be between
>the application and Unix.

The problem is that the X implementation in C does not talk to the Ada
RTS to tell it that its task wants to "delay".  The binding only allows
one to call the C implementation from an Ada program.

Like I said, to me the word binding does not imply recoding the function.
To me that's an implementation.  I agree, if someone reimplements XNextEvent
and thus XtAppMainLoop to not put the process to sleep then you could use
tasks.  Essentially, there has to be a task that gets and dispatches the
events and when there are not pending events that task must do a delay,
in the Ada sense, which only tells the Ada RTS that that task doesn't need
CPU at this time, but does not prevent the OS from scheduling the process
that contains that task.

-------------------------------------------------------------------------------
Brett M. Kettering
PaperNet: LLNL P.O. Box 808 L-437 Livermore, CA.  94551
InterNet: KETTERING1@llnl.gov
TalkNet : (510) 423-3467
FaxNet  : (510) 423-4606

Unknown Debater: "We need a national speed limit of 55 mph."
Homer Simpson  : "Oh sure, it might save a few lives, but millions
		  would be late."
Sammy Hagar    : "I can't drive 55."
-------------------------------------------------------------------------------