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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!weretis.net!feeder6.news.weretis.net!feeder.usenetexpress.com!feeder-in1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!buffer1.nntp.dca1.giganews.com!buffer2.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Thu, 25 Jul 2019 13:56:37 -0500 From: Dennis Lee Bieber Newsgroups: comp.lang.ada Subject: Re: Task_Barriers Date: Thu, 25 Jul 2019 14:56:37 -0400 Organization: IISS Elusive Unicorn Message-ID: <1gtjjetkm3np9j7dglv91acgripnee2ao5@4ax.com> References: User-Agent: ForteAgent/8.00.32.1272 X-No-Archive: YES MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-oTwpgKTDpRNF8Ofgs78RKsdxsEGld+ArHat/67Gz8EPuzLE76Qmffp9WdmSW4C+LJYklCYMmKUjSfjm!ky9GXoqmADoVgidwbDNjT7RQDy0S673CBtXelzUiXL4oS9KqiNe0YfqaCV7jgj6klFz/vjsR X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html 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.40 X-Original-Bytes: 2640 Xref: reader01.eternal-september.org comp.lang.ada:56945 Date: 2019-07-25T14:56:37-04:00 List-Id: On Thu, 25 Jul 2019 09:32:15 -0700 (PDT), Gilbert Gosseyn declaimed the following: > task body T2 is > begin > loop > delay 1.0 ; > Wait_For_Release (SB, Notified) ; > Y:=Y+1; > end loop ; > end T2 ; >begin > null ; >end Task_Barriers ; > >This program runs forever, although it should stop when reaching an internal count number? How did you determine "forever"? Ignoring the synchronization part, the loops have a one second delay per cycle, and you are incrementing an integer. Presuming integer is 32 bits, that means a loop that will take >>> 0x7FFFFFFF 2147483647 >>> seconds to complete. According to my HP-48sx, 2147483647_s -> 68.0511038598_yr (assuming integers generate overflow exceptions, your program will complete sometime in 2087) The description of Wait_For_Release() http://www.ada-auth.org/standards/12rat/html/Rat12-1-3-4.html has me wondering what purpose it really serves. "All the tasks are then released and just one of them is told about it by the parameter Notified being True. The general idea is that this one task then does something on behalf of all the others." So there is no determinism as to which task gets the True flag; that means any one of the waiting tasks could be responsible for doing this common activity, while the other tasks are doing what? -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com http://wlfraed.microdiversity.freeddns.org/