Questions tagged [locking]
Locking allows different types of resources to be locked by a transaction.
168 questions
4 votes
1 answer
185 views
Maintaining a memory-barrier with an expression-bodied member
I have a C# class with a number of properties that are read by and set by multiple threads. I use a simple lock when getting and setting them in order to have a full-fence memory barrier, so member ...
2 votes
0 answers
182 views
Namespace-scope try_lock_for / try_lock_until pt. 2
This is my second iteration of implementing try_lock_for/try_lock_until function templates in which I've cherry-picked a bunch ...
5 votes
2 answers
190 views
unique_multilock (unique_lock + scoped_lock) implementation
Inspired by How to implement unique_lock for multiple mutexes? I've implemented a RAII mutex locker with the combined capabilities of std::unique_lock and ...
4 votes
1 answer
422 views
Did I write the locks properly to prevent concurrency issues?
There may be a dozen things that could be improved about this code, but it's just a very quick proof of concept and for the sake of this post I'm specifically wanting to know if someone can verify ...
2 votes
3 answers
158 views
Simple rwlock implementation in C
Can someone please review my rwlock implementation to see if there are any issues with correctness (hopefully not), give any feedback on how to write good C code etc, design patterns which could be ...
1 vote
1 answer
360 views
Lock Guard Atomic alternative
I've recently written a Vulkan library for creating 2D applications with ease. The catch was I need std::lock_guard for my window resize event to resize resources ...
8 votes
3 answers
2k views
Basic RAII spinlock class
I have written the following class that acts as a simple lock for mutual exclusion: ...
2 votes
1 answer
248 views
C++20 simple RwSeqLock
I recently discovered the atomic wait/notify mechanism in C++20 and wrote this readers-writer lock in the style of Linux kernel Seqlock. Writes have to be inside a lock/unlock, while reads are ...