comp.lang.ada
 help / color / mirror / Atom feed
* Re: is there a 'wait' command in Ada
  1996-11-29  0:00 is there a 'wait' command in Ada ***** LOTUS *****
@ 1996-11-29  0:00 ` Robert A Duff
  1996-11-30  0:00 ` Michael Feldman
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 21+ messages in thread
From: Robert A Duff @ 1996-11-29  0:00 UTC (permalink / raw)



In article <Pine.SOL.3.91.961129204410.12801A-100000@sirius>,
***** LOTUS *****  <nt5bf@herts.ac.uk> wrote:
>I've just started using Ada.. and want to know if there is a 'wait' command
>in Ada. What I mean is that; if I want a particular text to appear after, 
>lets say, 10 seconds. What command do I use.

    delay 10.0;
    Put_Line("particular text");

There's also "delay until".

- Bob




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

* is there a 'wait' command in Ada
@ 1996-11-29  0:00 ***** LOTUS *****
  1996-11-29  0:00 ` Robert A Duff
                   ` (4 more replies)
  0 siblings, 5 replies; 21+ messages in thread
From: ***** LOTUS ***** @ 1996-11-29  0:00 UTC (permalink / raw)



hi! 

I've just started using Ada.. and want to know if there is a 'wait' command
in Ada. What I mean is that; if I want a particular text to appear after, 
lets say, 10 seconds. What command do I use.

Thankyou

n.thaker@herts.ac.uk





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

* Re: is there a 'wait' command in Ada
@ 1996-11-29  0:00 tmoran
  0 siblings, 0 replies; 21+ messages in thread
From: tmoran @ 1996-11-29  0:00 UTC (permalink / raw)



>What I mean is that; if I want a particular text to appear after,
>lets say, 10 seconds. What command do I use.
  delay 10.0;




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

* Re: is there a 'wait' command in Ada
  1996-11-29  0:00 is there a 'wait' command in Ada ***** LOTUS *****
  1996-11-29  0:00 ` Robert A Duff
@ 1996-11-30  0:00 ` Michael Feldman
  1996-11-30  0:00   ` Robert Dewar
  1996-12-02  0:00 ` Corey Minyard
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 21+ messages in thread
From: Michael Feldman @ 1996-11-30  0:00 UTC (permalink / raw)



In article <Pine.SOL.3.91.961129204410.12801A-100000@sirius>,
***** LOTUS *****  <nt5bf@herts.ac.uk> wrote:
>hi! 
>
>I've just started using Ada.. and want to know if there is a 'wait' command
>in Ada. What I mean is that; if I want a particular text to appear after, 
>lets say, 10 seconds. What command do I use.
>
delay 1.0;

will usually work. Compiler? Platform? Sometimes the behavior is a
bit unexpected, so more info will help us to help you.

Mike Feldman
------------------------------------------------------------------------
Michael B. Feldman -  chair, SIGAda Education Working Group
Professor, Dept. of Electrical Engineering and Computer Science
The George Washington University -  Washington, DC 20052 USA
202-994-5919 (voice) - 202-994-0227 (fax) 
http://www.seas.gwu.edu/faculty/mfeldman
------------------------------------------------------------------------
       Pork is all that money the government gives the other guys.
------------------------------------------------------------------------
WWW: http://www.adahome.com or http://info.acm.org/sigada/education
------------------------------------------------------------------------




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

* Re: is there a 'wait' command in Ada
  1996-11-30  0:00 ` Michael Feldman
@ 1996-11-30  0:00   ` Robert Dewar
  1996-12-01  0:00     ` Michael Feldman
  0 siblings, 1 reply; 21+ messages in thread
From: Robert Dewar @ 1996-11-30  0:00 UTC (permalink / raw)



michael feldman says

"delay 1.0;

will usually work. Compiler? Platform? Sometimes the behavior is a
bit unexpected, so more info will help us to help you."


I don't get it, delay 1.0 must work on any implementation of Ada, what
do you have in mind here Mike?





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

* Re: is there a 'wait' command in Ada
  1996-11-30  0:00   ` Robert Dewar
@ 1996-12-01  0:00     ` Michael Feldman
  1996-12-01  0:00       ` Robert Dewar
  1996-12-02  0:00       ` David C. Hoos, Sr.
  0 siblings, 2 replies; 21+ messages in thread
From: Michael Feldman @ 1996-12-01  0:00 UTC (permalink / raw)



In article <dewar.849411873@merv>, Robert Dewar <dewar@merv.cs.nyu.edu> wrote:
>michael feldman says
>
>"delay 1.0;
>
>will usually work. Compiler? Platform? Sometimes the behavior is a
>bit unexpected, so more info will help us to help you."
>
>I don't get it, delay 1.0 must work on any implementation of Ada, what
>do you have in mind here Mike?

OK, you asked for it...:-)

One would think that a simple delay followed by a Put would be platform-
independently portable, but in this case the devil turns out to be in
the details.:-)

The delay will work, of course, but the poster's question was "how
do I pause my program before displaying a message?" Exactly when the 
output will appear may be surprising. Sometimes a Flush is needed to 
force it to the screen, for example.

Moreover, when running GNAT under GDB, including any tasking stuff 
causes surprising behavior (or no behavior at all), and delay is
part of the tasking stuff in GNAT, etc., etc. 

I was quite interested by this question. Some (including Robert) 
have asserted that using delay just to pause an interactive program 
was not a very interesting idea. Evidently others think otherwise.

I've argued that delay is a useful statement, completely independent of 
its RM introduction in the tasking chapter. Indeed, my book is crazy
enough to use delay in several examples as a "pause" statement. This 
has turned out to be a bit of a thorn in my students' sides, because 
at GW, our intro courses run everything under GDB, which is hidden in 
a script to produce a nice traceback on an unhandled exception.

GNAT, for better or worse, links in delay - even a simple delay in a 
non-tasking program - as part of the tasking runtime. Because of the
unfriendly relations between tasking and GDB, programs that use
simple delays don't work under our scripts. We've ended up writing
a package called Sleep_Package, which exports a procedure Sleep
that just uses a simple Unix sleep call. That works fine, but the
students scratch their heads about why they have to change their code
because the Ada in the book doesn't behave as advertised.

Well, Robert, you asked the question, so I had to answer it.:-)

Mike Feldman




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

* Re: is there a 'wait' command in Ada
  1996-12-01  0:00     ` Michael Feldman
@ 1996-12-01  0:00       ` Robert Dewar
  1996-12-02  0:00         ` Larry Kilgallen
  1996-12-02  0:00         ` Michael Feldman
  1996-12-02  0:00       ` David C. Hoos, Sr.
  1 sibling, 2 replies; 21+ messages in thread
From: Robert Dewar @ 1996-12-01  0:00 UTC (permalink / raw)



Mike said

"GNAT, for better or worse, links in delay - even a simple delay in a
non-tasking program - as part of the tasking runtime. Because of the
unfriendly relations between tasking and GDB, programs that use
simple delays don't work under our scripts. We've ended up writing
a package called Sleep_Package, which exports a procedure Sleep
that just uses a simple Unix sleep call. That works fine, but the
students scratch their heads about why they have to change their code
because the Ada in the book doesn't behave as advertised.

Well, Robert, you asked the question, so I had to answer it.:-)"



Ah ha! "don't work under our scripts", so just possibly this is a Feldman
scriopt issue and not a fundamental Ada issue :-)





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

* Re: is there a 'wait' command in Ada
  1996-12-01  0:00     ` Michael Feldman
  1996-12-01  0:00       ` Robert Dewar
@ 1996-12-02  0:00       ` David C. Hoos, Sr.
  1996-12-09  0:00         ` Fergus Henderson
  1 sibling, 1 reply; 21+ messages in thread
From: David C. Hoos, Sr. @ 1996-12-02  0:00 UTC (permalink / raw)



Hi Mike,
Have you ever thought of using the UNIX select function to implement a
"delay that doesn't burn CPU cycles or issue s shell command?
All you need to do is set all three of the file descriptor mask addresses
to null addresses, and point to a timeval structure initialized with the
desired delay time, and the UNIX kernel will swap you out until the time
has expired.  Works like a champ!
-- 
David C. Hoos, Sr.,
http://www.dbhwww.com
http://www.ada95.com

Michael Feldman <mfeldman@seas.gwu.edu> wrote in article
<57smdo$9qv@felix.seas.gwu.edu>...
> In article <dewar.849411873@merv>, Robert Dewar <dewar@merv.cs.nyu.edu>
wrote:
> >michael feldman says

> OK, you asked for it...:-)
> 
> One would think that a simple delay followed by a Put would be platform-
> independently portable, but in this case the devil turns out to be in
> the details.:-)
> 





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

* Re: is there a 'wait' command in Ada
  1996-12-01  0:00       ` Robert Dewar
@ 1996-12-02  0:00         ` Larry Kilgallen
  1996-12-02  0:00         ` Michael Feldman
  1 sibling, 0 replies; 21+ messages in thread
From: Larry Kilgallen @ 1996-12-02  0:00 UTC (permalink / raw)



In article <dewar.849498825@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) writes:
> Mike said
> 
> "GNAT, for better or worse, links in delay - even a simple delay in a
> non-tasking program - as part of the tasking runtime. Because of the
> unfriendly relations between tasking and GDB, programs that use
> simple delays don't work under our scripts. We've ended up writing
> a package called Sleep_Package, which exports a procedure Sleep
> that just uses a simple Unix sleep call. That works fine, but the
> students scratch their heads about why they have to change their code
> because the Ada in the book doesn't behave as advertised.
> 
> Well, Robert, you asked the question, so I had to answer it.:-)"
> 
> 
> 
> Ah ha! "don't work under our scripts", so just possibly this is a Feldman
> scriopt issue and not a fundamental Ada issue :-)

Sounds to me like a debugger issue.

Larry Kilgallen




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

* Re: is there a 'wait' command in Ada
  1996-11-29  0:00 is there a 'wait' command in Ada ***** LOTUS *****
  1996-11-29  0:00 ` Robert A Duff
  1996-11-30  0:00 ` Michael Feldman
@ 1996-12-02  0:00 ` Corey Minyard
  1996-12-03  0:00   ` Michael Feldman
                     ` (2 more replies)
  1996-12-03  0:00 ` Corey Minyard
  1996-12-10  0:00 ` Robert I. Eachus
  4 siblings, 3 replies; 21+ messages in thread
From: Corey Minyard @ 1996-12-02  0:00 UTC (permalink / raw)



kilgallen@eisner.decus.org (Larry Kilgallen) writes:

> 
> In article <dewar.849498825@merv>, dewar@merv.cs.nyu.edu (Robert Dewar) writes:
> > Mike said
> > 
> > "GNAT, for better or worse, links in delay - even a simple delay in a
> > non-tasking program - as part of the tasking runtime. Because of the
> > unfriendly relations between tasking and GDB, programs that use
> > simple delays don't work under our scripts. We've ended up writing
> > a package called Sleep_Package, which exports a procedure Sleep
> > that just uses a simple Unix sleep call. That works fine, but the
> > students scratch their heads about why they have to change their code
> > because the Ada in the book doesn't behave as advertised.
> > 
> > Well, Robert, you asked the question, so I had to answer it.:-)"
> > 
> > 
> > 
> > Ah ha! "don't work under our scripts", so just possibly this is a Feldman
> > scriopt issue and not a fundamental Ada issue :-)
> 
> Sounds to me like a debugger issue.
> 
> Larry Kilgallen

This has bugged me since I started using GNAT.  If you use a delay,
you get a multi-threaded application.  There is no way around it that
I have found.  It is not a debugger issue (although a multi-threaded
debugger would be useful).  There are other side-effects, too.  Under
Linux, if you add a delay you will no longer be able to stop your
application with a ^C.

The delay could just call usleep or select to do its job (which should
work under threads), but instead it uses the thread package sleep
routines.  There is probably a reason for this, but it is rather
inconvenient.

-- 
Corey Minyard               Internet:  minyard@metronet.com
  Work: minyard@nortel.ca       UUCP:  minyard@wf-rch.cirr.com
-- 
Corey Minyard               Internet:  minyard@metronet.com
  Work: minyard@nortel.ca       UUCP:  minyard@wf-rch.cirr.com




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

* Re: is there a 'wait' command in Ada
  1996-12-01  0:00       ` Robert Dewar
  1996-12-02  0:00         ` Larry Kilgallen
@ 1996-12-02  0:00         ` Michael Feldman
  1 sibling, 0 replies; 21+ messages in thread
From: Michael Feldman @ 1996-12-02  0:00 UTC (permalink / raw)



In article <dewar.849498825@merv>, Robert Dewar <dewar@merv.cs.nyu.edu> wrote:
>Mike said
>
>Ah ha! "don't work under our scripts", so just possibly this is a Feldman
>scriopt issue and not a fundamental Ada issue :-)
>
Well, the problem manifests itself in our script situation, but the
scripts are not the cause of the problem. 

I never said any of this was a fundamental Ada issue. I _did_ say (and
did mean) that the behavior is sometimes surprising.

In running GNAT under GDB, things like simple delays do not behave as 
expected (try it). And a simple delay, followed by a simple Put, does
NOT always display the message after exactly that amount of time.
Things like IO buffering give unexpected results. 

These are neither bugs nor fundamental Ada issues, rather implementation
issues, but they bite nonetheless. They especially bite people who are 
trying to move over from other languages and to understand just what the 
RM means.

The original question was NOT "what is the Ada equivalent of pause", but 
"how do I get my program to pause for 5 seconds, then display a message 
on the screen". The answer "the delay statement" gives a partial answer only.

I stand by my answer, "the delay statement is part way to a solution, but
unless we know the platform and compiler, we can't say for sure."

Robert (or anyone else), if this is so easily and portably done (including 
under a debugger like GDB), please post a short program illustrating it. 
My answer was neither idle nor completely uninformed, but you may have a 
solution I didn't think of. Instead of joking around, write a complete
little program that compiles and (portably) shows the desired behavior.

I stand by the second part of the answer too, which is "GNAT should not be
hauling tasking code into a program that does only a simple delay but
no tasking." This is an implementation decision that causes lots of
needlesss grief to those trying to debug simple sequential programs.
Maybe it will be fixed someday.

Mike Feldman




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

* Re: is there a 'wait' command in Ada
  1996-12-02  0:00 ` Corey Minyard
  1996-12-03  0:00   ` Michael Feldman
  1996-12-03  0:00   ` Robert A Duff
@ 1996-12-03  0:00   ` Larry Kilgallen
  1996-12-03  0:00     ` Michael Feldman
  2 siblings, 1 reply; 21+ messages in thread
From: Larry Kilgallen @ 1996-12-03  0:00 UTC (permalink / raw)



In article <m2hgm4vnzz.fsf@metronet.com>, Corey Minyard <minyard@metronet.com> writes:

> This has bugged me since I started using GNAT.  If you use a delay,
> you get a multi-threaded application.  There is no way around it that
> I have found.  It is not a debugger issue (although a multi-threaded
> debugger would be useful).

If the debugger in question cannot deal with threads, that still
seems to me to be a debugger issue.  I thought I read from Mike's
comment that a correct program would run alright unless the
debugger is introduced.

Larry Kilgallen




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

* Re: is there a 'wait' command in Ada
  1996-12-02  0:00 ` Corey Minyard
  1996-12-03  0:00   ` Michael Feldman
@ 1996-12-03  0:00   ` Robert A Duff
  1996-12-03  0:00   ` Larry Kilgallen
  2 siblings, 0 replies; 21+ messages in thread
From: Robert A Duff @ 1996-12-03  0:00 UTC (permalink / raw)



In article <m2hgm4vnzz.fsf@metronet.com>,
Corey Minyard  <minyard@metronet.com> wrote:
>...Under
>Linux, if you add a delay you will no longer be able to stop your
>application with a ^C.

Why is that?  Is that a bug in Linux, or a bug in the GNAT RTS?

- Bob




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

* Re: is there a 'wait' command in Ada
  1996-11-29  0:00 is there a 'wait' command in Ada ***** LOTUS *****
                   ` (2 preceding siblings ...)
  1996-12-02  0:00 ` Corey Minyard
@ 1996-12-03  0:00 ` Corey Minyard
  1996-12-04  0:00   ` Robert Dewar
  1996-12-04  0:00   ` Keith Thompson
  1996-12-10  0:00 ` Robert I. Eachus
  4 siblings, 2 replies; 21+ messages in thread
From: Corey Minyard @ 1996-12-03  0:00 UTC (permalink / raw)



kilgallen@eisner.decus.org (Larry Kilgallen) writes:
> In article <m2hgm4vnzz.fsf@metronet.com>, Corey Minyard <minyard@metronet.com> writes:
> 
> > This has bugged me since I started using GNAT.  If you use a delay,
> > you get a multi-threaded application.  There is no way around it that
> > I have found.  It is not a debugger issue (although a multi-threaded
> > debugger would be useful).
> 
> If the debugger in question cannot deal with threads, that still
> seems to me to be a debugger issue.  I thought I read from Mike's
> comment that a correct program would run alright unless the
> debugger is introduced.
> 

I'm not saying that the lack of a threaded-aware debugger is ok when
debugging multi-threaded programs.  I'm saying that requiring a
threaded-aware debugger to debug a program that is not multi-threaded
is a problem.

IMHO, the GNAT compiler should only require threads if using tasks.
Since delay is not implicitly an operation requiring threads, it
shouldn't require them.

I wrote an Ada application to send pages to my alphanumeric pager.  It
used delay to time operations for retrying them.  My wife (for whom
the program was written :-) was very annoyed that she could not ^C the
program (due to it using pthreads).  So, I modified GNAT to use
linuxthreads (a kernel posix thread package) which works better in
that respect.  I would have preferred to not have to do that.  But now
I can do System V shared semaphores in a multi-task application
without locking up the whole process, which is something else I
needed.

-- 
Corey Minyard               Internet:  minyard@metronet.com
  Work: minyard@nortel.ca       UUCP:  minyard@wf-rch.cirr.com
-- 
Corey Minyard               Internet:  minyard@metronet.com
  Work: minyard@nortel.ca       UUCP:  minyard@wf-rch.cirr.com




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

* Re: is there a 'wait' command in Ada
  1996-12-03  0:00   ` Larry Kilgallen
@ 1996-12-03  0:00     ` Michael Feldman
  1996-12-04  0:00       ` Larry Kilgallen
  0 siblings, 1 reply; 21+ messages in thread
From: Michael Feldman @ 1996-12-03  0:00 UTC (permalink / raw)



In article <1996Dec3.072025.1@eisner>,
Larry Kilgallen <kilgallen@eisner.decus.org> wrote:

>If the debugger in question cannot deal with threads, that still
>seems to me to be a debugger issue.  I thought I read from Mike's
>comment that a correct program would run alright unless the
>debugger is introduced.

Yes, that's true. So what? How should one debug a program that uses a
simple delay? A program that behaves funny under the debugger
behaves funny. Recall that I answered the original question by
saying "the behavior may be surprising." I stand by that statement.:-)

Actually, I've been messing with GDB on Solaris to see if there's a
workaround. It turns out that SIGWAITING is raised, apparently, 
whenever a delay or whatever is encountered in the program. On
Solaris at least, typing, at the gdb command prompt,

handle SIGWAITING nostop
handle SIGWAITING noprint

seems to work. I haven't tried this (yet) on other platforms.

In any event, this is not the least bit obvious to a non-GDB expert.

Mike Feldman




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

* Re: is there a 'wait' command in Ada
  1996-12-02  0:00 ` Corey Minyard
@ 1996-12-03  0:00   ` Michael Feldman
  1996-12-03  0:00   ` Robert A Duff
  1996-12-03  0:00   ` Larry Kilgallen
  2 siblings, 0 replies; 21+ messages in thread
From: Michael Feldman @ 1996-12-03  0:00 UTC (permalink / raw)



In article <m2hgm4vnzz.fsf@metronet.com>,
Corey Minyard  <minyard@metronet.com> wrote:

>This has bugged me since I started using GNAT.  If you use a delay,
>you get a multi-threaded application.  There is no way around it that
>I have found.  It is not a debugger issue (although a multi-threaded
>debugger would be useful).  There are other side-effects, too.  Under
>Linux, if you add a delay you will no longer be able to stop your
>application with a ^C.

The ctrl-C problem has plagued many GNAT ports; it's been fixed in
Solaris, DOS, OS/2, and Mac, and my guess is that whoever knows the
Linux runtime could fix it there too. You might want to report it to 
report@gnat.com and see what response you get.

>The delay could just call usleep or select to do its job (which should
>work under threads), but instead it uses the thread package sleep
>routines.  There is probably a reason for this, but it is rather
>inconvenient.

I'd just like to see something a bit smarter in gnatlink (I guess that's
where it would be written) that notices whether or not any other tasking 
stuff is needed, and if only simple delays are present, links a simple 
call to an ordinary sleep.

This has come up before; like so many other things, finding a solution
is just a matter of focusing on it and giving it some priority. As I
understand it, ACT has its hands full, so hasn't focused much on this. 
They've also opined, at times, that it's uncommon to use a simple delay 
to pause a program, so other things get priority on their to-do list.

Mike Feldman




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

* Re: is there a 'wait' command in Ada
  1996-12-03  0:00     ` Michael Feldman
@ 1996-12-04  0:00       ` Larry Kilgallen
  0 siblings, 0 replies; 21+ messages in thread
From: Larry Kilgallen @ 1996-12-04  0:00 UTC (permalink / raw)



In article <583052$1tg@felix.seas.gwu.edu>, mfeldman@seas.gwu.edu (Michael Feldman) writes:
> In article <1996Dec3.072025.1@eisner>,
> Larry Kilgallen <kilgallen@eisner.decus.org> wrote:
> 
>>If the debugger in question cannot deal with threads, that still
>>seems to me to be a debugger issue.  I thought I read from Mike's
>>comment that a correct program would run alright unless the
>>debugger is introduced.
> 
> Yes, that's true. So what? How should one debug a program that uses a
> simple delay? A program that behaves funny under the debugger
> behaves funny. Recall that I answered the original question by
> saying "the behavior may be surprising." I stand by that statement.:-)

Yes, exactly.

When I paraphrased your comment about the debugger involvement
I intended to emphasize that the problem is not due to "Mike's
funny padded room for students" but rather due to "the debugger",
an environment where one should be able to expect operation to be
identical to regular operation except for specially documented
debugging _features_.

In a non-Ada VMS environment I keep running into well-intentioned
individuals who want to rebuild a large program compiled /nooptimize
for general debugging of reported problems.  They just don't value
having an exact byte-for-byte match with what the end user runs,
including any optimizer decisions.  To me the whole value of a
debugger is in being able to reproduce the _exact_ circumstances
of a problem, although most that I have encountered cannot get
the area beyond the end of the stack to match the non-debugger
environment exactly :-).

Larry Kilgallen




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

* Re: is there a 'wait' command in Ada
  1996-12-03  0:00 ` Corey Minyard
@ 1996-12-04  0:00   ` Robert Dewar
  1996-12-04  0:00   ` Keith Thompson
  1 sibling, 0 replies; 21+ messages in thread
From: Robert Dewar @ 1996-12-04  0:00 UTC (permalink / raw)



I have no trouble using GDB with programs that have delays in them. Works
fine on several targets that I tried. I am aware of the problem Mike has
with his automatic scripts, but if there are more general problems in
using GDB with any of the standard GNAT ports, they should be reported
to report@gnat.com as usual.

Robert Dewar





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

* Re: is there a 'wait' command in Ada
  1996-12-03  0:00 ` Corey Minyard
  1996-12-04  0:00   ` Robert Dewar
@ 1996-12-04  0:00   ` Keith Thompson
  1 sibling, 0 replies; 21+ messages in thread
From: Keith Thompson @ 1996-12-04  0:00 UTC (permalink / raw)



In <m2bucby5qx.fsf@metronet.com> Corey Minyard <minyard@metronet.com> writes:
[...]
> IMHO, the GNAT compiler should only require threads if using tasks.
> Since delay is not implicitly an operation requiring threads, it
> shouldn't require them.

But delay statements do affect task scheduling, and there's no way
to determine, when a delay statement is compiled, whether it will be
executed by a program with multiple tasks.

Making delay statements behave differently depending on whether the
program has multiple tasks is an interesting and doable optimization,
but it's not necessarily a trivial one.

-- 
Keith Thompson (The_Other_Keith) kst@aonix.com <http://www.aonix.com> <*>
TeleSo^H^H^H^H^H^H Alsy^H^H^H^H Thomson Softw^H^H^H^H^H^H^H^H^H^H^H^H^H Aonix
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2706
"SPOON!" -- The Tick




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

* Re: is there a 'wait' command in Ada
  1996-12-02  0:00       ` David C. Hoos, Sr.
@ 1996-12-09  0:00         ` Fergus Henderson
  0 siblings, 0 replies; 21+ messages in thread
From: Fergus Henderson @ 1996-12-09  0:00 UTC (permalink / raw)



"David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> writes:

>Have you ever thought of using the UNIX select function to implement a
>"delay that doesn't burn CPU cycles or issue s shell command?
>All you need to do is set all three of the file descriptor mask addresses
>to null addresses, and point to a timeval structure initialized with the
>desired delay time, and the UNIX kernel will swap you out until the time
>has expired.  Works like a champ!

That works OK in a single-task program, but in a multitasking
program, the UNIX kernel may swap out the whole _process_ rather
than just delaying the individual task.

--
Fergus Henderson <fjh@cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3         |     -- the last words of T. S. Garp.




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

* Re: is there a 'wait' command in Ada
  1996-11-29  0:00 is there a 'wait' command in Ada ***** LOTUS *****
                   ` (3 preceding siblings ...)
  1996-12-03  0:00 ` Corey Minyard
@ 1996-12-10  0:00 ` Robert I. Eachus
  4 siblings, 0 replies; 21+ messages in thread
From: Robert I. Eachus @ 1996-12-10  0:00 UTC (permalink / raw)




   "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com> writes:

   >Have you ever thought of using the UNIX select function to implement a
   >"delay that doesn't burn CPU cycles or issue s shell command?
   >All you need to do is set all three of the file descriptor mask addresses
   >to null addresses, and point to a timeval structure initialized with the
   >desired delay time, and the UNIX kernel will swap you out until the time
   >has expired.  Works like a champ!

   It looks like what everyone is looking for is an implementation of
delay with the effective logic:

   if Number_of_Tasks = 1
   then Unix.Sleep(N) 
   else Ada.Runtime.Delay(N);
   end if;

   (I plan on general prinicples to ignore any discussion of the
"extra overhead" in doing things this way. If you execute a delay
statement you should only complain if it doesn't take as long as
requested, and a busy wait is an appropriate implementation for very
short delays.)

   Also it should be the case that a runtime which supports pragma
Restrictions(Max_Tasks => 0) should not load the tasking runtime, even
if this requires special support for (more efficient) protected types.

--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




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

end of thread, other threads:[~1996-12-10  0:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-29  0:00 is there a 'wait' command in Ada ***** LOTUS *****
1996-11-29  0:00 ` Robert A Duff
1996-11-30  0:00 ` Michael Feldman
1996-11-30  0:00   ` Robert Dewar
1996-12-01  0:00     ` Michael Feldman
1996-12-01  0:00       ` Robert Dewar
1996-12-02  0:00         ` Larry Kilgallen
1996-12-02  0:00         ` Michael Feldman
1996-12-02  0:00       ` David C. Hoos, Sr.
1996-12-09  0:00         ` Fergus Henderson
1996-12-02  0:00 ` Corey Minyard
1996-12-03  0:00   ` Michael Feldman
1996-12-03  0:00   ` Robert A Duff
1996-12-03  0:00   ` Larry Kilgallen
1996-12-03  0:00     ` Michael Feldman
1996-12-04  0:00       ` Larry Kilgallen
1996-12-03  0:00 ` Corey Minyard
1996-12-04  0:00   ` Robert Dewar
1996-12-04  0:00   ` Keith Thompson
1996-12-10  0:00 ` Robert I. Eachus
  -- strict thread matches above, loose matches on Subject: below --
1996-11-29  0:00 tmoran

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