comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Interresting difference in Normal-Returns/Expression-Functions and Extended-Returns.
Date: Wed, 1 May 2013 21:20:07 -0500
Date: 2013-05-01T21:20:07-05:00	[thread overview]
Message-ID: <klsih1$qhd$1@munin.nbi.dk> (raw)
In-Reply-To: e0c67da2-159a-4a37-b199-1d80312f6aca@googlegroups.com

"Shark8" <onewingedshark@gmail.com> wrote in message 
news:e0c67da2-159a-4a37-b199-1d80312f6aca@googlegroups.com...
...
>> Delay
>> also causes context switching. When you use null statement the main task
>> likely to manage to create all contestant before any of them gains the
>> processor (depending on OS settings and number of cores available).

>I have four cores; that shouldn't be a problem though -- I'm using the 
>protected
>object to manage my text-output debugging.

But doing that is a Bounded_Error (see 9.5.1(8-18), and specifically 
paragraph 18).

It of course might work as you intend (that's one of the possible results), 
but its something you should avoid in code unless you never, ever expect to 
run it on a different Ada compiler.

To do this correctly, you have to use a lock object, typically wrapped in a 
controlled object so that initialization does the locking and finalization 
does the unlocking (that way you don't have to worry about abort or 
exceptions screwing up your locking). I'll leave the code needed as an 
exercise for the OP. :-)

                          Randy.


  parent reply	other threads:[~2013-05-02  2:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-22 18:27 Interresting difference in Normal-Returns/Expression-Functions and Extended-Returns Shark8
2013-04-22 19:13 ` Dmitry A. Kazakov
2013-04-22 20:11   ` Shark8
2013-04-23  6:15     ` Simon Wright
2013-04-23  7:35     ` Stephen Leake
2013-04-23  8:58     ` Dmitry A. Kazakov
2013-05-02  2:20     ` Randy Brukardt [this message]
2013-05-02  4:41       ` Shark8
2013-04-23  6:32 ` egilhh
2013-04-23 15:24   ` Adam Beneschan
2013-04-24  5:56     ` egilhh
2013-04-24 14:40       ` Adam Beneschan
2013-04-25  5:30         ` egilhh
2013-04-25  5:41           ` Shark8
2013-04-23 16:00 ` Adam Beneschan
2013-04-23 16:52   ` Simon Wright
2013-04-23 17:57     ` Adam Beneschan
2013-04-25  8:48       ` egilhh
2013-04-25 15:19         ` Adam Beneschan
2013-05-02  2:33         ` Randy Brukardt
2013-05-02  2:38       ` Randy Brukardt
2013-05-02 16:15         ` Adam Beneschan
2013-05-02 22:00           ` Randy Brukardt
2013-05-03  1:11         ` Adam Beneschan
2013-05-03  5:34           ` Simon Wright
2013-05-03  6:43           ` egilhh
2013-05-03 16:49             ` Adam Beneschan
2013-05-03 23:09           ` Randy Brukardt
2013-04-23 23:00     ` Shark8
2013-04-23 23:16       ` Adam Beneschan
2013-05-02  2:28   ` Randy Brukardt
2013-05-02 16:37     ` Adam Beneschan
2013-04-23 16:33 ` Simon Wright
replies disabled

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