-
Notifications
You must be signed in to change notification settings - Fork 15
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
Make circular buffer thread-safe #19
Comments
cbuf already has single reader/writer semantics, as expected from a FIFO (see http://www.glip.io/group__development-cbuf.html). What kind of thread-safety are you looking for? |
multiple producer, single consumer for outgoing and single producer, multiple consumer for outgoing. I think the userspace should be allowed to be multithreaded. |
What's the specific use case for that? And how common is it to justify putting the locking overhead into the library itself, as opposed to letting the user of the library add locking if necessary? |
It should be used to a NBDS then anyways. We are already locking at each access, so even moving the lock a bit does not harm for the moment. Overall nothing urgent, but thread-safety is important. |
Use case: Generating data from multiple threads |
From all cases I can think of and have implemented, the application that uses GLIP is implementing a higher-level protocol on top of the FIFO semantics provided by GLIP. Almost all protocols rely on specific data ordering. To provide this data ordering, a sequential write or read is necessary. If the data is written or read ordered, already an implicit locking is present in the user's code and there's no need for concurrent access to the read or write functions. Therefore, could you please sketch a specific use case where we Independent of that, as you mentioned, the implementation of the cbuf read/write functions could be improved to be non-blocking. Doing this is, however, independent of the question what thread safety guarantees cbuf should provide. |
Regarding your question, full thread-safety is the best and favorable property on the glip API in general |
I think making the circular buffer thread-safe is a first step towards #8
The text was updated successfully, but these errors were encountered: