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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,10d1a90a699d6cfc X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!bcklog2.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 18 Apr 2007 21:01:55 -0500 From: "Steve" Newsgroups: comp.lang.ada References: <20070418201307.18a85fd9@cube.tz.axivion.com> <20070419004345.171ee93e@cube.tz.axivion.com> Subject: Re: Ada tasking question Date: Wed, 18 Apr 2007 19:02:21 -0700 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Original Message-ID: NNTP-Posting-Host: 24.20.111.245 X-Trace: sv3-4pIbvWdANIF25cSFkjNdS+XYy/EhJfMsK7jN3nYcuTlndOrxc+tXe0PplKKIOJc0SuJ+Lw6E4zT0OmT!wT5689vMGD/3dg7tF0y1PzDE8gWlHUA9GDNbaBdaQzOtu4i7i8cdSbxo6B2yT4yecs8/U5hLAGrM!KypiuvnoTLF2v1C8XewF4Y72UStFag== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.34 Xref: g2news1.google.com comp.lang.ada:15111 Date: 2007-04-18T19:02:21-07:00 List-Id: "Stefan Bellon" 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