Questions tagged [locking]
Locking allows different types of resources to be locked by a transaction.
168 questions
4
votes
1
answer
120
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 ...
0
votes
0
answers
39
views
ReadWrite Lock compatible with coroutines
A while ago I wrote for my own needs a (non-reentrant) read-write lock for kotlin's coroutines. I got no reactions on the relevant github thread. I think it's a nice code, so I thought I'd share it ...
2
votes
0
answers
170
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 ...
4
votes
1
answer
148
views
Freestanding try_lock_for / try_lock_until
This is a breakout of a small part of unique_multilock (unique_lock + scoped_lock) implementation where it was suggested to put the logic in the member functions ...
5
votes
2
answers
168
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
101
views
Simple async lock using key in .NET
The task is to make a simple LockProvider that will lock a thread by identifier.
Basic requirements:
Simple call via using block.
Support for CancelationToken to get out of waiting without exceptions....
4
votes
1
answer
393
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 ...
1
vote
1
answer
60
views
Distributed locking with fencing token implementation in Golang
I was reading about the implementation of distributed locks where we need to verify the lease using a fencing token as per this article - https://martin.kleppmann.com/2016/02/08/how-to-do-distributed-...
2
votes
3
answers
135
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 ...
4
votes
2
answers
1k
views
Distributed lock system using AWS S3
I need a distributed lock system for a service I'm writing. (There can be multiple instances of this service running at a time, and I need to make sure that only one instance does a particular cron ...
1
vote
1
answer
345
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 ...
2
votes
1
answer
196
views
Dart Non-Reentrant Async Lock
This class synchronizes access to an async resource. If retainFutureErrors is false, it will keep retrying until there is a success. Otherwise, the ...
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:
...
0
votes
1
answer
322
views
php flock with timeout (for LOCK_SH / LOCK_EX )
i want a flock with timeout, unfortunately i haven't found a good way to implement it (like a signaled timeout on an actual blocking request?), so i'm just trying and sleeping until success or timeout,...
2
votes
1
answer
231
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 ...