comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <spamoff.danx@ntlworld.com>
Subject: multitasking: finishing execution
Date: Thu, 20 Jun 2002 10:57:55 +0100
Date: 2002-06-20T10:57:55+01:00	[thread overview]
Message-ID: <1HhQ8.8744$ZP1.1591823@news11-gui.server.ntli.net> (raw)

Hi,

Is calling the entry finish sufficient to terminate the task?  The code of
the entry isn't the concern, but the behaviour of entries.  Consider the
following procedure

procedure finish_tasks is
begin
   some_task.finish;                                     -- 1
   ada.text_io.put ("some_task should have terminated"); -- 2
end finish_tasks;


-- sample task code
--
loop
   select
      accept Finish;
      exit;
   else
      -- do some processing (sample code)
      --
      if x < integer'last then
         x := x + 1;
      end if;
   end select;
end loop;


Can the call to some_task.finish time out?  If it can there's no guarantee
that the task has finished executing before the call to ada.text_io.put is
executed and the program may fail to terminate because it has running tasks,
correct?

As you can see I'm a little confused by the fact that an entry can time out.
Does it mean that the call can time out no matter what or that the task has
to contain the appropriate code for an entry call to time out (such as a
delay altenative)?  i.e. will the procedure wait indefinitely for the task
to terminate or will it abandon the entry call after some time elapses?

If the code doesn't work as intended, what solution would you recommend?  Is
there a better way?


Thanks,
Chris





             reply	other threads:[~2002-06-20  9:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-20  9:57 chris.danx [this message]
2002-06-20 12:48 ` multitasking: finishing execution Nige
2002-06-20 16:19   ` chris.danx
2002-06-20 20:40     ` Stephen Leake
2002-06-20 14:53 ` Stephen Leake
2002-06-20 19:30   ` chris.danx
2002-06-21 18:14     ` Ted Dennison
replies disabled

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