-
-
Notifications
You must be signed in to change notification settings - Fork 20.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional count argument to Semaphore::post
#93605
Conversation
0076121
to
96f75a8
Compare
Semaphore::post
May I ask in what occasion would this be useful? It is a relatively innocent change, but it's still worth knowing why it would need to be done. |
It's just so you dont have to do a for loop anymore to resume more and more threads, and it would be way more optimized than constantly locking and unlocking the mutex, adding 1 to the count and running |
96f75a8
to
3e0606b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving my approval on the added API. This needs to have the compatibility stuff fixed (which I'm not very familiar with) fixed per @AThousandShips comments before merging.
Was a named method considered ( |
e62d00d
to
de4386b
Compare
de4386b
to
33e5b4b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is count
as the name of the parameter completely fine? Yyyyeah, I'm sure it'll be fine.
33e5b4b
to
2656714
Compare
The co-author additions for just reviews aren't necessary by the way, feel free to remove them |
2656714
to
0b2f1e4
Compare
9f8db92
to
272bb73
Compare
Co-authored-by: RandomShaper <[email protected]> Co-authored-by: A Thousand Ships (she/her) <[email protected]> Co-authored-by: Mickeon <[email protected]>
272bb73
to
6311ee5
Compare
I think we can safely push this to 4.4 . Still waiting on the GDExtension and DotNet teams for review. |
Thanks! |
I've found something a bit concerning... One of my PRs was tested against 4.3, where it worked. On master it broke. The reason was that on master I had to add |
The |
It's been discussed (forget where) and I've looked at some tricks to make it easier by creating a custom callable from a But will see about opening some issue to track it and look at ideas when I can |
If this is a severe problem reverting this PR should be fine as it's a relatively small Quality-of-Life feature. |
Implements a new optional argument in Semaphore.post to allow resuming multiple threads at once.