home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!mimsy!alex
- From: alex@cs.umd.edu (Alex Blakemore)
- Newsgroups: comp.lang.ada
- Subject: Re: Ada tasking rules and AST's...
- Message-ID: <59190@mimsy.umd.edu>
- Date: 23 Jul 92 15:27:56 GMT
- References: <1992Jul22.194130.10544@europa.asd.contel.com>
- Sender: news@mimsy.umd.edu
- Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742
- Lines: 48
-
- In article <1992Jul22.194130.10544@europa.asd.contel.com> king@ssvax.gte.com (Larry King) writes:
- > My question is how can I get Ada to do a rescheduling of the
- > tasks to get this new entry to run. There is one process that takes
- > some amount of time but if the system call has finished we would like
- > the AST entry to run before this task normally finishes. Currently we
- > issue a delay statement for the time
- > DURATION'SMALL but this causes us to lose 10 milliseconds of time just
- > to do the delay. It does cause VAX Ada to run the AST entry but we would like
- > to avoid losing the 10 milliseconds if possible. Does VAX Ada (or any
- > Ada for that matter) allow you to force an execution of the next entry on
- > the queue before the current task has completely finished?
-
- I'm not sure I understand your question completely, but you can use
-
- delay 0.0; -- the delay does not have to be positive
- -- can even be negative (in which case your system
- -- moves backwards in time, actually same as zero)
-
- This inserts a synchronization point in your code - when it executes
- the run time system must relinquish the processor to any higher
- priority eligible task. If there is no such task, then this is a noop
- except for the time to check the ready queue. You can also insert
- selective accept statements with else parts to check specific queues.
-
- Both these methods involve stating explictly at which points you are willing
- to relinquish the processor or accept a new entry.
-
- ... code, possibly in another accept stmt
- select
- accept my_ast_entry do
- ... do something;
-
- end;
- else
- null; -- no ast was there
- end select;
- ... get back to previous work
-
- scattering this throughout could get a little ugly - there are probably
- better ways. Using 'Count is NOT one of them in general.
- Ada9X offers some other nice alternatives to allow asynchronous
- transfer of control and handle interrupts.
-
- hope this helps
-
- --
- -------------------------------
- Alex Blakemore alex@cs.umd.edu
-