comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Re: Structure of the multitasking server
Date: Sun, 21 Sep 2008 10:30:37 -0700 (PDT)
Date: 2008-09-21T10:30:37-07:00	[thread overview]
Message-ID: <259e95c5-92e6-4200-bc6e-5f35d99336a9@l64g2000hse.googlegroups.com> (raw)
In-Reply-To: 1w9y1ocmu2cm3$.724p6fohqdvy$.dlg@40tude.net

On 19 Wrz, 19:02, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:

> Note that task termination is usually a difficult problem in Ada. You
> should pay an attention to this early.

No problem with that. With separate protected object (instead of
rendezvous) it is enough to do this:

   protected type Channel_State is
      procedure Post (J : in Job_Type);
      procedure Finish;
      entry Get_Job (J : out Job_Type; Finished : out Boolean);
      function Busy return Boolean;
   private
      State : Worker_State := Idle;
      Job_To_Do : Job_Type;
      Should_Finish : Boolean := False;
   end Channel_State;

and later in the worker task:

      loop
         Ch.all.Get_Job (Job, Finished);
         exit when Finished;

         --  do the job ...

      end loop;


There is no need to introduce any special type of job ("poison pill").
Above, the job space is not polluted with task lifetime management
concepts - these should be kept separate.

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com

Database Access Library for Ada: www.inspirel.com/soci-ada



  reply	other threads:[~2008-09-21 17:30 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 12:21 Structure of the multitasking server Maciej Sobczak
2008-09-19 13:34 ` Jean-Pierre Rosen
2008-09-19 17:02   ` Dmitry A. Kazakov
2008-09-21 17:30     ` Maciej Sobczak [this message]
2008-09-21 19:24       ` Dmitry A. Kazakov
2008-09-21 21:27         ` Maciej Sobczak
2008-09-22  8:12           ` Dmitry A. Kazakov
2008-09-22 12:47             ` Maciej Sobczak
2008-09-22 14:11               ` Dmitry A. Kazakov
2008-09-23  8:07                 ` Maciej Sobczak
2008-09-23  9:37                   ` Dmitry A. Kazakov
2008-09-23 10:47                   ` Jean-Pierre Rosen
2008-09-21 17:23   ` Maciej Sobczak
2008-09-22  8:23     ` Jean-Pierre Rosen
2015-03-12 16:07   ` gautier_niouzes
2015-03-12 21:38     ` Jacob Sparre Andersen
2015-03-12 22:39       ` gautier_niouzes
2015-03-13  8:15         ` Dmitry A. Kazakov
2015-03-13 20:16           ` gautier_niouzes
2015-03-13 20:47             ` Dmitry A. Kazakov
2015-03-15  7:43               ` gautier_niouzes
2015-03-15  8:35                 ` Simon Wright
2015-03-15  8:52                 ` J-P. Rosen
2015-03-15  9:21                   ` Jacob Sparre Andersen
2015-03-15 16:04                     ` Brad Moore
2015-03-13 23:04             ` Randy Brukardt
2015-03-14  8:22               ` Simon Wright
2008-09-19 23:01 ` anon
2008-09-21 17:37   ` Maciej Sobczak
2008-09-22  2:32     ` anon
2008-09-22 13:05       ` Maciej Sobczak
2008-09-23  9:25         ` anon
replies disabled

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