Questions tagged [locking]

-1 votes
0 replies
Locking entire SQLite3 database during update
I have to update a SQLite3 database, which will drop a table, recreate it, and then repopulate the table. I want to ensure all my other processe...
asked 4 months ago
7 votes
2 replies
Does this implementation of mutex locks result in undefined behavior?
I need to control the frequency at which main processes data. In the example, it just increases the value of a variable. I cannot use sleep insid...
asked 4 months ago
-2 votes
0 replies
Why are locks thread-safe? [duplicate]
Does it mean that two threads can't change the underlying data simultaneously? Or does it mean that the given code segment will run with predicta...
asked 4 months ago
0 votes
0 replies
How to use readerwriter lock per field
Hello i have an object with some fields.I want this object to be thread safe. This object will be accesed by two threads and changed.However The...
asked 4 months ago
0 votes
1 replies
Achieving Isolation for Specific Rows in Database C#
I have an application which issues letters to users in sequential order. This is the database structure ------------------- UserID LastIssued -...
asked 4 months ago
1 votes
2 replies
Using Library Functions in Multi-threaded Code (Common Lisp)
When a variable can be accessed/updated from multiple threads, it normally needs protection from simultaneous changes. One efficient approach is...
1 votes
2 replies
Is there a way to prevent multiple executions of controller method in Symfony 4?
I have a service which I use both from a custom command and an HTML page. I want to prevent multiple executions of the the service in parallel. F...
asked 4 months ago
0 votes
0 replies
Python multiprocessing: When to use Array instead of RawArray?
I am trying to read thousands of small images from disk and store them in a large Numpy array. Of course, I can do this sequentially but this wil...
0 votes
0 replies
Lock a table from Select purpose
If there is a table that contains un-encrypted sensitive data, and want to use this table in a View but want to lock it from the general usage li...
asked 4 months ago
2 votes
1 replies
Reentrant locks within monads in Scala
A colleague of mine stated the following, about using a Java ReentrantReadWriteLock in some Scala code: Acquiring the lock here is risky. It'...
1 votes
1 replies
Django-Channels: Lock critical section in class
I have a class that extends WebsocketConsumer and thus communicates to the client via a websocket. From my understanding the whole process is eve...
0 votes
0 replies
Update by primary key causes transaction lock
I am updating a large table with millions on rows on the primary KEY and it causes transaction lock (Lock wait time exceeded). The query is an u...
asked 4 months ago
0 votes
0 replies
Is there a way to query SQLite/SQLite3 if an immediate transaction is currently open?
Is there a way to query SQLite/SQLite3 if an immediate transaction is currently open? Or putting it another way is there any way of knowing if th...
asked 5 months ago
0 votes
1 replies
Android app lock app return after authentication
I'm trying to build an app lock application. I have created a service to monitor current running apps. And checking which app is opened, I redire...
asked 5 months ago
0 votes
1 replies
Is my socket connection dropping some data sent over it?
I'm writing a Connection class that sends and receives data going both ways via Commands and CommandResults. However, when multiple requests are...
asked 5 months ago
2 votes
1 replies
How will ReentrantLock object created inside a method's local scope work?
The above is a screen print from OCP 7 java se book. page 791. My question is if a new ReentrantLock object is created in a method every time...
1 votes
1 replies
ReentrantLock tryLock(timeout,timeUnit) doesn't work as expected
I have some confuse about ReentrantLock tryLock(timeout,timeUnit) method , when running below code it seems tryLock timeout until the previous th...
asked 5 months ago
2 votes
0 replies
Is it possible to apply different locks on a same resource
I have a scenario where I need to apply different locks on a section of code. Let's say I have n number of servers and for each server I am calli...
asked 5 months ago
1 votes
2 replies
Is it a good practice to use locks for queuing tasks?
I need to put some requests that can arrive at any time in a queue, in a way that each task only starts when the previous one ends. The question...
asked 6 months ago
3 votes
1 replies
An AsyncDuplicateLock that can be locked on all keys
I need a lock similar to the one from this answer from Stephen Cleary: https://stackoverflow.com/a/31194647/4381408 However, I also need to be a...
asked 5 months ago
1 votes
2 replies
flock() vs. fcntl() semantics in glibc
Related: one, two It's stated that flock() (BSD-locks) and fcntl() (POSIX record-level locks) gives the user incompatible semantics, particularl...
asked 5 months ago
1 votes
1 replies
How to forbid 2 users to edit the same data in a web application using MySQL (with CodeIgniter if possible)
I use CodeIgniter 3 and MariaDB 5.0 on my dev environment (but MySQL 5.6 in the prod environment). I created a web app, and implemented a valida...
0 votes
0 replies
Linux kernel scheduling with critical regions
I've written a linux kernel module for an USB device. The USB driver provides 2 read-only character devices, which can be opened only exclusively...
asked 5 months ago
0 votes
2 replies
What is the difference between synchronized fields and ReadWriteLocks?
Just want to know how the below codes that does the same functionality differs Code 1: class ReadWriteCounter { ReadWriteLock lock = ne...
0 votes
1 replies
Using flock() to lock a file opened with fopen() [duplicate]
This question already has an answer here: How do I lock files using fopen()? 6 a...
asked 5 months ago