comp.lang.ada
 help / color / mirror / Atom feed
* GUI's generating Ada (was Re: Teleuse)
@ 1993-04-26 20:53 news-feed-1.peachnet.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!usc!ne
  0 siblings, 0 replies; 6+ messages in thread
From: news-feed-1.peachnet.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!usc!ne @ 1993-04-26 20:53 UTC (permalink / raw)


I'm curious.  For all these GUI's that generate Ada, can I use Ada
tasking within my application code while linked to the GUI generated
interface code?  I know that I can do so with Sun's DevGuide/Ada
(XView)  (with some limitations), but that some special effort was done
in the Ada XView bindings to allow this.  As it was explained to me
(over 2 years ago), X and Ada tasking use the same interupts so some
care must be taken when both are linked in the same application. 
 
It's been awhile since I've been interested in this topic, so I'm
curious what the current state of X and Ada (with tasking) is at this
point for the current GUI's.  And is this a Sun/Unix/XView only problem
or true of all OS's/toolkits?


Thanks!

---
----------------------------------------------------------------------
Buffy Hyler (hyler@ast.saic.com)
SAIC, Campus Point
San Diego, California
----------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GUI's generating Ada (was Re: Teleuse)
@ 1993-04-27  4:08 sdd.hp.com!portal!cup.portal.com!JimB
  0 siblings, 0 replies; 6+ messages in thread
From: sdd.hp.com!portal!cup.portal.com!JimB @ 1993-04-27  4:08 UTC (permalink / raw)


The major problem with X and Ada is the fact, that for the most part,
X is non-reentrant. If your Ada compiler uses different methods for 
tasking then X uses for message distribution (???) you can use Ada
tasks with X. However, you must be VERY careful what X structures
are used by Ada tasks. The safest way to implement this is to use a
single Ada guard task that ALL X calls are "funneled" through.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GUI's generating Ada (was Re: Teleuse)
@ 1993-04-27 12:30 Scott McCoy
  0 siblings, 0 replies; 6+ messages in thread
From: Scott McCoy @ 1993-04-27 12:30 UTC (permalink / raw)


In article <1993Apr26.205307.13187@ast.saic.com>, hyler@ast.saic.com (Buffy
Hyler) writes:
|> I'm curious.  For all these GUI's that generate Ada, can I use Ada
|> tasking within my application code while linked to the GUI generated
|> interface code?  

You can with Screen Machine, from OIS.  Good tool.

-- 
Scott McCoy	Harris ISD	Opinions expressed are my own.
Staff Eng - SW	Internet: 	smccoy@dw3v.ess.harris.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GUI's generating Ada (was Re: Teleuse)
@ 1993-04-27 16:13 John Goodsen
  0 siblings, 0 replies; 6+ messages in thread
From: John Goodsen @ 1993-04-27 16:13 UTC (permalink / raw)


hyler@ast.saic.com (Buffy Hyler) writes:
>
>I'm curious.  For all these GUI's that generate Ada, can I use Ada
>tasking within my application code while linked to the GUI generated
>interface code?  I know that I can do so with Sun's DevGuide/Ada
>(XView)  (with some limitations), but that some special effort was done
>in the Ada XView bindings to allow this.  As it was explained to me
>(over 2 years ago), X and Ada tasking use the same interupts so some
>care must be taken when both are linked in the same application. 
> 

There are basically 2 issues at hand here and they are not isolated to
X window applications, but most C applications which get Ada bindings
put on them:

  1) When a UNIX process blocks for I/O or other reasons, *ALL* Ada tasks 
     in that UNIX process are also blocked.

  2) Most C libraries, including X/Xt/Motif/Xview are not written to handle
     multiple threads of control accessing the library within a single
     process address space (eg. an Ada task).  The net result is that 
     library state data can be trashed by more than one Ada task accessing it.
     This is sometimes referred to as "non-rentrant" code, but is more
     accurately referred to as "non thread-safe" code (early versions of 
     FORTRAN is an example of non-rentrant code).

An example of case #1 is witnessed in the Xtoolkit/Motif/Xview in which
a main loop sits on top of an I/O connection and waits for packets
of data to come across, which are dispatched as X events (eg. XtMainLoop() )
The C implementation of these loops typically blocks the UNIX process until
some data appears, which blocks any other Ada tasks which might be running.
The solution to this is quite simple and has been implemented by all
serious Motif and Xview binding vendors that I'm aware of.  You simply,
write you're own main dispatching loop in Ada which peeks at the IO connection
before telling the OS to read from it.  If nothing is there to read,
then the loop executes an Ada delay statement, which lets other tasks
execute.

Case #2 is more of a problem.  Basically, you have to synchronize your
tasks to ensure that only one thread of control accesses the library at
a time.  A *real* Ada binding should perform this synchronization (actually
serialization) for you, and alleviate you of the headache.  A readers/writers
algorithm works, except that you need to be sure to let the same thread
of control into the library in the case of recursive, round-trips between
the library and the application.  To do this, you need the task id of the
Ada task (which is not required in the Ada language but provided by some
Ada compiler vendors).

On a related note, can anyone tell me off-hand if Ada 9X will provide a call
like:

     current_task := CURRENT_TASK_ID;
                     ^^^^^^^^^^^^^^^
                     A function which returns the current task id.

I know you can do the similar thing with task types, but task types
require you to have a task identifier ahead of time, which inhibits
a portable solution for task safe bindings across multiple compiler
vendors.

hope this helps


-- 
John Goodsen                EVB Software Engineering, Inc.
jgg@evb.com                    - Ada & Object Oriented Training/Products
(301) 695-6960                 - Ada GUI & Graphics Tools and Training
                               - Software Reuse, Process & Environments

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GUI's generating Ada (was Re: Teleuse)
@ 1993-04-28 15:09 cis.ohio-state.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!ho
  0 siblings, 0 replies; 6+ messages in thread
From: cis.ohio-state.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!ho @ 1993-04-28 15:09 UTC (permalink / raw)


In article <1993Apr27.161337.18593@evb.com> jgg@evb.com (John Goodsen) writes:
>hyler@ast.saic.com (Buffy Hyler) writes:

>On a related note, can anyone tell me off-hand if Ada 9X will provide a call
>like:
>
>     current_task := CURRENT_TASK_ID;
>                     ^^^^^^^^^^^^^^^
>                     A function which returns the current task id.

Yes, the System Programming annex provides a package System.Task_Identification
.
In it, an impl-defined type (Task_ID) is declared with "=" and Image on 
objects of this type.  In addition the function Current_Task is declared  
and returned that type.  Finally (for the package) a NULL constant and an 
abort through this type are also present.  
Two attributes exist:

'Identity which returns a value of Task_id  and is applicable to any task 
object, and 'Caller that is applicable for entries and returns the task_id of
the caller on "whose behalf" the entry body or accept statement is cuurrently
executed.

(See G.5.1 in the latest draft for precise details).  


Offer Pazy
9X MRT

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: GUI's generating Ada (was Re: Teleuse)
@ 1993-04-28 18:27 cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!falis
  0 siblings, 0 replies; 6+ messages in thread
From: cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!falis @ 1993-04-28 18:27 UTC (permalink / raw)


An alternative to non-rentrant X and providing a specific task to control
access to X routines are the two packages Alsys reselss from TopGraph-X:
These are Ada implementations of X and the PEX extensions to X; they're
available for a variety of platforms, including for embedded applications
and LynxOS with threads.

- Ed Falis, Alsys

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1993-04-28 18:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-04-27 12:30 GUI's generating Ada (was Re: Teleuse) Scott McCoy
  -- strict thread matches above, loose matches on Subject: below --
1993-04-28 18:27 cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!falis
1993-04-28 15:09 cis.ohio-state.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!ho
1993-04-27 16:13 John Goodsen
1993-04-27  4:08 sdd.hp.com!portal!cup.portal.com!JimB
1993-04-26 20:53 news-feed-1.peachnet.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!usc!ne

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox