From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,97f543c7a63b8839 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!news.germany.com!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Composing tasks and protected objects Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <87iryk1eic.fsf@mid.deneb.enyo.de> Date: Sat, 6 Aug 2005 11:01:51 +0200 Message-ID: NNTP-Posting-Date: 06 Aug 2005 11:01:49 MEST NNTP-Posting-Host: 226dc960.newsread2.arcor-online.net X-Trace: DXC=mmLI>1OL@NM[T26?78JQ5U85hF6f;DjW\KbG]kaMH41Ud:;E]@4Ca3[P:U3RZ On Fri, 05 Aug 2005 19:26:35 +0200, Florian Weimer wrote: > 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; You could make "Reload_Configuration" and "Shut_Down" messages rather than entries. Of course only if you don't need to wait for their completion. Otherwise you are going to mix synchronous calls with fire-and-forget messaging. It is always difficult. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de