[issue45311] Threading Semaphore and BoundedSemaphore release method implementation improvement

2021-10-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This code was added in bpo-10978. Raymond, what are your thoughts?

--
nosy: +rhettinger
versions: +Python 3.11 -Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45311] Threading Semaphore and BoundedSemaphore release method implementation improvement

2021-10-21 Thread Besart Dollma


Besart Dollma  added the comment:

This is another illogical behaviour, if I am trying to release 5 threads, and I 
fail the releasing the first one, why should I try the first one 5 times?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45311] Threading Semaphore and BoundedSemaphore release method implementation improvement

2021-10-20 Thread Ken Jin


Change by Ken Jin :


--
nosy: +pitrou, serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45311] Threading Semaphore and BoundedSemaphore release method implementation improvement

2021-10-20 Thread Andrei Kulakov


Change by Andrei Kulakov :


--
nosy: +kj

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45311] Threading Semaphore and BoundedSemaphore release method implementation improvement

2021-10-20 Thread Andrei Kulakov


Andrei Kulakov  added the comment:

Besart: with the current code, if there's a valueError when releasing a thread, 
it will be retried again n times, with your change, n waiting threads will be 
released, even if some of them fail with ValueError.

I don't know enough about threading module to say if this change should be made.

--
nosy: +andrei.avk

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue45311] Threading Semaphore and BoundedSemaphore release method implementation improvement

2021-09-28 Thread Besart Dollma


New submission from Besart Dollma :

Hi, 
I was looking at the implementation of Semaphore and BoundedSemaphore in 
threading.py and I saw that `notify` is called on a loop n times while it 
supports an n parameter. 

https://github.com/python/cpython/blob/84975146a7ce64f1d50dcec8311b7f7188a5c962/Lib/threading.py#L479

Unless I am missing something, removing the loop and replacing it with 
self._cond.notify(n) will slightly improve performance by avoiding the function 
call overhead.

I can prepare a Pool Request if the change is acceptable.
Thanks,

--
components: Library (Lib)
messages: 402779
nosy: besi7dollma
priority: normal
severity: normal
status: open
title: Threading Semaphore and BoundedSemaphore release method implementation 
improvement
type: enhancement
versions: Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com