comp.lang.ada
 help / color / mirror / Atom feed
From: "Steve" <nospam_steved94@comcast.net>
Subject: Re: Ada tasking question
Date: Wed, 18 Apr 2007 19:02:21 -0700
Date: 2007-04-18T19:02:21-07:00	[thread overview]
Message-ID: <J4-dna4f1Y0OULvbnZ2dnUVZ_vOlnZ2d@comcast.com> (raw)
In-Reply-To: 20070419004345.171ee93e@cube.tz.axivion.com

"Stefan Bellon" <sbellon@sbellon.de> wrote in message 
news:20070419004345.171ee93e@cube.tz.axivion.com...
> Jeffrey R. Carter wrote:
>
[snip]
> Yes, in fact I already implemented it this way before I saw your
> posting. :-)
>
>   protected Bucket_Jobs is
>      procedure Init (Index : in Integer);
>      entry Next (Index : out Integer);
>   private
>      Current : Integer;
>   end Bucket_Jobs;
>
>   protected body Bucket_Jobs is
>      procedure Init (Index : in Integer) is
>      begin
>         Current := Index;
>      end Init;
>
>      entry Next (Index : out Integer) when True is
>      begin
>         Index := Current;
>         Current := Current + 1;
>      end Next;
>   end Bucket_Jobs;
>

If you don't mind sacraficing portability, some systems have an "Interlocked 
Increment" function that is a very lightweight option for implementing this 
functionality.  On x86 architecture it basically maps to a hardware 
instruction that locks the bus while incrementing and returns the result.

Regards,
Steve
(The Duck)

>
> -- 
> Stefan Bellon 





  reply	other threads:[~2007-04-19  2:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-18 18:13 Ada tasking question Stefan Bellon
2007-04-18 18:40 ` Randy Brukardt
2007-04-18 20:12   ` Jeffrey R. Carter
2007-04-18 22:43     ` Stefan Bellon
2007-04-19  2:02       ` Steve [this message]
2007-04-18 21:08   ` Leif Holmgren
2007-04-18 22:57     ` Stefan Bellon
2007-04-18 23:41       ` Brian May
2007-04-19  0:25       ` Randy Brukardt
2007-04-19  8:02         ` Stefan Bellon
2007-04-19 12:47         ` Jacob Sparre Andersen
2007-04-19 16:11           ` Anh Vo
2007-04-20  4:32           ` Jeffrey R. Carter
2007-04-19  0:50       ` Jeffrey R. Carter
2007-04-18 19:50 ` Alex R. Mosteo
2007-04-18 23:00   ` Stefan Bellon
2007-04-19 20:37   ` Pascal Obry
2007-04-19  2:13 ` jimmaureenrogers
2007-04-19  7:49 ` Dmitry A. Kazakov
  -- strict thread matches above, loose matches on Subject: below --
1996-10-18  0:00 whiting_ms@corning.com (Matt Whiting)
replies disabled

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