comp.lang.ada
 help / color / mirror / Atom feed
From: Florian Weimer <fw@deneb.enyo.de>
Subject: Composing tasks and protected objects
Date: Fri, 05 Aug 2005 19:26:35 +0200
Date: 2005-08-05T19:26:35+02:00	[thread overview]
Message-ID: <87iryk1eic.fsf@mid.deneb.enyo.de> (raw)

Suppose I want to write a selective accept which reads messages from a
queue, and also support a special entry call to reload the
configuration.

Conceptually, this would look like this:

   task Server is
      entry Reload_Configuration (Config : Config_Template);
      entry Shut_DOwn;
   end Server;

   task body Server is
      Current_Message : Message;

   begin
      loop
         select
            Get (Queue, Current_Message);
            Process_Message (Current_Message);

         or
            accept Reload_Configuration (Config : Config_Template) do
               Process_Reload (Config);
            end Reload_Configuration;

         or
            accept Shut_Down;
            exit;       -- Premature shut down requested

         or
            terminate;  -- Normal shutdown at end of scope
         end select;
      end loop;
   end Server;

In short, I want to perform protected entry calls and selective accept
in parallel.

Is this possible at all, without writing lots of stupid wrappers?  If
not, what was the justification for not integrating the two language
features (protected objects/tasks) in this way?



             reply	other threads:[~2005-08-05 17:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-05 17:26 Florian Weimer [this message]
2005-08-05 17:49 ` Composing tasks and protected objects Robert A Duff
2005-08-05 18:09   ` Florian Weimer
2005-08-05 18:26     ` Robert A Duff
2005-08-05 19:20       ` Florian Weimer
2005-08-07  1:27       ` Randy Brukardt
2005-08-08 21:55         ` Robert A Duff
2005-08-06  5:52 ` Jeffrey Carter
2005-08-08  9:52   ` Florian Weimer
2005-08-08 20:50     ` Randy Brukardt
2005-08-08 22:14       ` Robert A Duff
2005-08-06  9:01 ` Dmitry A. Kazakov
replies disabled

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