Questions tagged [locking]
Locking allows different types of resources to be locked by a transaction.
163 questions
4votes
1answer
382views
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 ...
2votes
1answer
51views
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-...
2votes
3answers
115views
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 ...
4votes
2answers
1kviews
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 ...
1vote
1answer
331views
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 ...
1vote
1answer
177views
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 ...
8votes
3answers
2kviews
Basic RAII spinlock class
I have written the following class that acts as a simple lock for mutual exclusion: ...
0votes
1answer
296views
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,...
2votes
1answer
204views
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 ...
7votes
1answer
531views
C++ mutex-like class using std::condition_variable
On a project I'm working on, I have a need for a mutual-exclusion primitive behaving like std::mutex or std::recursive_mutex, ...
2votes
1answer
210views
Distributed lock service implementation in Golang
I have multiple E2E tests (written in Java) which share login details, each test during runtime will query the locker API for login details which is running on its own dedicated server. Below is my ...
0votes
1answer
123views
Data Wrapper Class with Automatic Saving and Locked Read/Write Accessors
This is a wrapper for a synchronized data structure that: Saves periodically Keeps track of dirty flag automatically (set when a write access is requested) Maintains a lock on data Only allows access ...
2votes
1answer
1kviews
C# lock on string value
Our codebase is full of locks such as: lock("Something." + var) { .... } This causes issues due to strings not meant to be used in locks in this way. ...
6votes
3answers
2kviews
Least Recently Used Cache with TTL
I found this problem in a book and found it interesting. wrote this class to implement a Least Recently Used Cache with TTL. Goal - LRU cache with TTL Multithreaded. Functions: Get(key), Put(key,...
15votes
2answers
2kviews
Block-free priority lock
Background I wanted to write an event loop that supports scheduling, but found that no implementation of priority queue that I know of supports waiting on a condition variable (the idea is that the ...