comp.lang.ada
 help / color / mirror / Atom feed
* Elegant 'abort' of sleeping task
@ 2003-03-31 13:18 Simon Apperley
  2003-03-31 13:28 ` Lutz Donnerhacke
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Simon Apperley @ 2003-03-31 13:18 UTC (permalink / raw)


Hi,

I'm looking at the design of a piece of server code which has to
handle calls that also pass a timeout value. The target system is
aerospace related, and dynamically creating tasks 'on the fly' just is
not an option.

I want to be able to set up a single task to handle the timeout from
the head of a delta-queue of timeouts, but have found a problem. If I
have the timeout implemented as a task stuck in a 'delay' call, and a
more immediate timeout comes in, I want to wake up the sleeping task,
re-calculate the delta-queue and then sleep on the new, shorter,
delay. So far the only way I can see to do this is to use abort, and
set up the task again, which seems a bit of a brute force approach.

Has anyone got any suggestions on how I can interrupt the sleep call,
without using a polling approach that would just consume CPU time at
the expense of the other code in the system.

I could use direct calls to the underlying RTOS, but I'd rather keep
as much as possible within the Ada language.

I did wonder about delay until TIME, and having another task change
TIME, but that seems rather un-safe to me as it starts making
assumptions about the underlying run-time implementation.

Thanks

Simon Apperley @ General Dynamics UK COM



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

end of thread, other threads:[~2003-04-01 16:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-31 13:18 Elegant 'abort' of sleeping task Simon Apperley
2003-03-31 13:28 ` Lutz Donnerhacke
2003-03-31 16:04 ` Jeffrey Carter
2003-04-01 12:02   ` Dmitry A. Kazakov
2003-03-31 16:49 ` David C. Hoos
2003-04-01 16:20 ` David C. Hoos
2003-04-01 16:26 ` Nick Roberts

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