andreiavrammsd / cpp-channel

Thread-safe container for sharing data between threads
https://blog.andreiavram.ro/cpp-channel-thread-safe-container-share-data-threads/
MIT License
400 stars 28 forks source link

Possible Race Condition in push #30

Open fennewald opened 1 year ago

fennewald commented 1 year ago

In the push implementation, closed is checked before the mutex to the channel is locked. This means a could check that the queue is not closed, but have it be closed while it acquires the mutex, pushing to a closed channel.

andreiavrammsd commented 1 year ago

Thanks for taking a look! I will leave the issue open until I get to it.