Open ashwin-hari opened 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.
@fefa4ka thanks, I've pushed another iteration
unlock
to also take an owner argument; this allows the implementation to perform more error-checking like trying to unlock a mutex acquired by another thread, etc.lock
be recursive 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
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
Addresses thread-safety, issue #2
lock
andunlock
may be used: An application stores logs; each log's owner field is set to a value that identifies which component of the application produced the log. Threads are used to read and process logs for a specific owner. The number of threads would be less than the number of components in the application. Latency doesn't matter here.gcc-8
, Ubuntu 20.04