[issue17374] Remove restriction against Semaphore having a negative value

2013-03-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: > msg183614 in #12768? Exactly. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-20 Thread Ezio Melotti
Ezio Melotti added the comment: msg183614 in #12768? -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: > You might want to rephrase the module docstring of Lib/threading.py > then :) I think I already suggested rephrasing it but apparently it was lost somewhere. -- ___ Python tracker

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-20 Thread Ezio Melotti
Ezio Melotti added the comment: You might want to rephrase the module docstring of Lib/threading.py then :) -- nosy: +ezio.melotti ___ Python tracker ___

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-20 Thread Antoine Pitrou
Antoine Pitrou added the comment: I also don't think "Java does it" is a good design justification anymore. Python's threading model is the Python threading model, even though it may have been inspired by Java at the start :-) -- title: Remove restriction against Semaphore having a negat

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-20 Thread Charles-François Natali
Charles-François Natali added the comment: >> POSIX semaphore don't support negative initial value. > > It was an early design decision to go with the Java threading model rather > than the POSIX model. The Java API supports negative initial values -- the > same Dijkstra's original P() and V()

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: [Antoine] > multiprocessing.Semaphore should be kept compatible > with threading.Semaphore. I just looked at the C code implementing multiprocessing Semaphore. Removing the negative count restriction there looks straight-forward. I'll include it in the p

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Charles-François Natali
Charles-François Natali added the comment: > As for accepting negative initialization values, it sounds like a reasonable > request. One reason for rejecting would be if it makes writing a fast > implementation harder. Also, multiprocessing.Semaphore should be kept > compatible with threading.

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: We already have a Barrier class actually: http://docs.python.org/dev/library/threading.html#barrier-objects As for accepting negative initialization values, it sounds like a reasonable request. One reason for rejecting would be if it makes writing a fast impl

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: > 3. When a thread increments the semaphore, if there are other > threads waiting, one of the waiting threads gets unblocked. Is a condition missing here? "if the resulting count is positive" Since the use case is different from a regular Semaphore,

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Raymond Hettinger
Raymond Hettinger added the comment: For reference, here is the Java API for a Semaphore ( http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Semaphore.html ): Semaphore - public Semaphore(int permits) Creates a Semaphore with the given number of permits and nonfair fai

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- nosy: +pitrou ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyt

[issue17374] Remove restriction against Semaphore having a negative value

2013-03-07 Thread Raymond Hettinger
New submission from Raymond Hettinger: I was working through the problem sets in The Little Book of Semaphores (http://www.greenteapress.com/semaphores/downey08semaphores.pdf) and ran into an issue because Python's threading.Semaphore has an unnecessary restriction against having negative valu