comp.lang.ada
 help / color / mirror / Atom feed
From: "Tomek Wałkuski" <tomek.walkuski@gmail.com>
Subject: Re: How to determine if task is busy or not?
Date: Sat, 8 Aug 2009 09:00:13 -0700 (PDT)
Date: 2009-08-08T09:00:13-07:00	[thread overview]
Message-ID: <e560a9fe-71f4-4ce2-ac32-85276b98d364@g1g2000vbr.googlegroups.com> (raw)
In-Reply-To: 4aef99b6-6ac6-4e0b-91d8-2a5320ea6e9c@l34g2000vba.googlegroups.com

On 8 Sie, 16:59, Maciej Sobczak <see.my.homep...@gmail.com> wrote:

> Depends. If it is the asking entity that is also providing the job,
> then the problem above cannot happen. In other words, if the "manager"
> asks the task whether it is busy or idle and the answer is "idle",
> then that answer it true until the same manager provides new work
> unit, because there is no other way for the task to switch from "idle"
> to "busy". Which means that the manager can always safely handle a new
> work unit to the "idle" task, no race is possible.
>
Only manager is providing work to the tasks. So, as you said, no race
is possible.

> To Tomek - the simplest way to deploy your original idea is to use a
> flag (Busy/Idle - an enumeration type is perfect here), which is
> shared and used by both the worker task and its manager. Protected
> object is a proper solution here and you might even use the same
> protected object for managing both the flag and the work unit itself.
>
That was my first thought :)



  reply	other threads:[~2009-08-08 16:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-08 10:49 How to determine if task is busy or not? Tomek Walkuski
2009-08-08 10:56 ` Ludovic Brenta
2009-08-08 11:27   ` Dmitry A. Kazakov
2009-08-08 14:59     ` Maciej Sobczak
2009-08-08 16:00       ` Tomek Wałkuski [this message]
2009-08-08 18:22       ` Dmitry A. Kazakov
2009-08-08 18:39         ` Ludovic Brenta
replies disabled

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