fefa4ka / linked_ring

It's just in place replacement for ring buffer, but without taking up all that extra space for multiply buffers used by different producers-consumers.
15 stars 2 forks source link

Thread-safety #3

Open ashwin-hari opened 1 year ago

ashwin-hari commented 1 year ago

Addresses thread-safety, issue #2

fefa4ka commented 1 year ago

Looks great! Wood be nice to change README, maybe add some info about thread-safety feature, and modify contribution section, at least no need inspire to do blocking mechanics.

ashwin-hari commented 1 year ago

@fefa4ka thanks, I've pushed another iteration

could you also build on your platform and ensure things work for you? I verified on my machine using Ubuntu 20.04 and gcc 8.4.0

fefa4ka commented 1 year ago

OS: Mac OS 13.1 Compiler: Apple clang version 14.0.0 (clang-1400.0.29.202) Compiler: gcc-12 (Homebrew GCC 12.2.0) 12.2.0 Target: arm64-apple-darwin22.2.0

❯ ./test_multi_thread
OK      Failed to initialize buffer
OK      Failed to create thread
OK      Failed to create thread
OK      Failed to create thread
OK      Failed to create thread
ERROR   Error while getting data from buffer (/Users/fefa4ka/Documents/linked_ring/test/multi_thread.c:127)

ERROR   Data does not match (/Users/fefa4ka/Documents/linked_ring/test/multi_thread.c:132)

ERROR   Test failed (/Users/fefa4ka/Documents/linked_ring/test/multi_thread.c:214)

@ashwin-hari I will try to debug