Author jmoy
Recipients jmoy, rhettinger
Date 2017-02-06.08:56:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <CALc-kK6tcxB8zG3HbW5aEWOz7d3KddYiY2yvnzjHusUxzp63MA@mail.gmail.com>
In-reply-to <1486368347.86.0.638779082631.issue29449@psf.upfronthosting.co.za>
Content
> > A return value from clear will indicate to a thread if it
> > won the race to clear the event.
>
> Why would we care who won the race to clear? I would think that the
> important thing is that the event is cleared, not who did it.
>

Here's the scenario that prompted my report: the Event is set to indicate
that certain 'work' has accumulated and one among a pool of workers uses
clear() to claim the work accumulated till that point. If clear() returned
a value, we could easily ensure that only one among the workers woken up
actually does the work.

Of course, in this case it would be more efficient to wake up just one
worker using a Condition object and notify() but then one has to write the
logic to maintain the state of the event. An Event whose clear() returned a
value would allow for a quick and dirty solution.
History
Date User Action Args
2017-02-06 08:56:19jmoysetrecipients: + jmoy, rhettinger
2017-02-06 08:56:19jmoylinkissue29449 messages
2017-02-06 08:56:18jmoycreate