c3c icon indicating copy to clipboard operation
c3c copied to clipboard

I'll take on adding semaphore support to C3

Open joshring opened this issue 9 months ago • 3 comments

I noticed that semaphores were not in the standard lib and could make things like the thread pool more efficient, so instead of polling a mutex eating CPU we could limit the capacity with a semaphore instead and save the resources. In some quick tests I was seeing 25-35 mutex checks typically with the initial implementation.

So far have added support for Linux and currently working on the windows implementation.

What's the best way to test MacOS as I don't own a Mac?

I am targeting a post V0.7 PR for this one

joshring avatar Mar 26 '25 09:03 joshring

I guess CI. Or you just enable it for Win/Linux and let me do the MacOS implementation

lerno avatar Mar 27 '25 10:03 lerno

Today I learned the unnamed semaphore functions are not supported on Mac

https://stackoverflow.com/questions/71977076/posix-semaphores-on-macos

Also mentioned here https://github.com/facebook/folly/issues/750

Will add some @if guards around those in the posix bindings. In the higher level c3wrapper will forward to the named semaphore functions and perhaps generate some names

joshring avatar Apr 06 '25 01:04 joshring

What's the status?

lerno avatar Aug 27 '25 10:08 lerno