c3c icon indicating copy to clipboard operation
c3c copied to clipboard

Could we replace `broadcast()` with `signal()` in these instances?

Open joshring opened this issue 6 months ago • 1 comments

As far as I understand it we should be able to replace broadcast() with signal() on these lines below. Because we're only adding a single job so only a single waiting thread needs to be notified, not all waiting threads, this should be less expensive, especially with a larger number of threads.

In these places: https://github.com/c3lang/c3c/blob/d143ec227c233e8f99ea3f3c3a1d97e483d5a720/lib/std/threads/fixed_pool.c3#L128 https://github.com/c3lang/c3c/blob/d143ec227c233e8f99ea3f3c3a1d97e483d5a720/lib/std/threads/pool.c3#L100

joshring avatar May 29 '25 23:05 joshring

Typically people will use broadcast because signal can be wonky. But you can try it.

lerno avatar May 30 '25 08:05 lerno