Re:Libcsp: a fast C concurrency library influenced by the CS...
by pickdenis on Monday April 06, 2020 @05:12PM
(#22797939)
I suspect it stops being so nice when you want to do something equivalent to go's `select` statement. Though that's purely speculation, and if I'm wrong it should definitely go in the examples!
Re:Libcsp: a fast C concurrency library influenced by the CS...
by dallbee on Monday April 06, 2020 @05:55PM
(#22798291)
Your skepticism made me look through the library more carefully. I came across some limitations in comparison to what Go provides:
1. As you suggest, there's no equivalent to the `select` mechanism. To perform the equivalent, you must busy loop and call `csp_chan_try_pop`.
2. It appears you cannot nest coroutines.
3. The mutex implementation does not provide an RWMutex.
4. `csp_yield` seems somewhat necessary for practical applications.
Normally I would not use another language as a basis for comparison to a C library, but that's precisely what the author of Libcsp appears to be aiming for.
All that said, there's a really slick implementation of a lock free RB queue backing this library, and It's a neat project. I think it would stand on its own better than as a "go style in C" library.
Re:Libcsp: a fast C concurrency library influenced by the CS...
by alexchamberlain on Tuesday April 07, 2020 @02:43AM
(#22800885)
RB queue?
Re:Libcsp: a fast C concurrency library influenced by the CS...
by erling on Tuesday April 07, 2020 @03:17AM
(#22801024)
ring buffer queue [0]
[0] https://github.com/shiyanhui/libcsp/blob/48782baf0e63cbf2914...
https://libcsp.com/