A lock generally refers to something that prevents another process from starting or accessing the same information until the lock is released. Use with an appropriate language tag. Do not use for physical locks.
Questions tagged [locks]
433 questions
4
votes
1 answer
Javascript and rendering pauses and stays paused on scroll in the android browser
I've found some wierd behaviour related to scrolling and rendering and javascript.
How to make it happen:
On any webpage that is long enough to scroll on. Start to scroll pretty fast (fling the page). then release the touch.
Now while the page is…

Andreas
- 158
- 7
4
votes
2 answers
C# Locks - Is it better to lock before a loop or inside it?
I'm currently making a Web Crawler in C#, and I have a method that receives HTML strings, extracts links from them and inserts the links into the list of all the links captured.
Since it is multi-threaded, I have used locks to prevent the list of…

BlueRay101
- 1,447
- 2
- 18
- 29
4
votes
2 answers
Java Synchronization with multiple objects/locks
I'm wondering if there's a package or model that will help me solve this scenario.
Let's say I have 3 threads and a bunch of objects A,B,C,D,E,F
T1 needs locks A,B
T2 needs locks B,C,D
T3 needs locks E,F
In this scenario, it'd be ok if T1 & T3 ran…

kane
- 5,465
- 6
- 44
- 72
3
votes
2 answers
How do I get the right locks for this SQL?
My database is SQL Server 2005/8. In a booking system we have a limit of 24 bookings on an event. This code in a stored procedure checks:
- that the current user (@UserId) is not already booked on the event (@EventsID)
- that the current event has…

RichardHowells
- 7,826
- 3
- 24
- 24
3
votes
0 answers
ROCKSDB Failed to acquire lock due to rocksdb_max_row_locks limit
Version: 10.4.8-MariaDB
engine: ROCKSDB
I have a table labor with 40 Mio rows and a table map with 200,000 rows and I wanted to update some columns of labor with. Since I got performance problems as the table increased I decided to migrate from…

giordano
- 2,954
- 7
- 35
- 57
3
votes
0 answers
mixing asyncio with fork in python: bad idea?
In the code i am writing i used to have both threads and multiple processes a fork:
threads for a websocket connection (and some other background tasks)
multiprocessing fork to create an isolated memory process which can be reloaded
This resulted…

Matthijs
- 439
- 3
- 16
3
votes
1 answer
Lock.java and LockSupport.java: what purpose we have LockSupport?
I have used basic object.wait() , object.notify() , object.notifyAll() in multi-threaded programming.
I know we have the package java.util.concurrent and it has java.util.concurrent.locks package. Specifically in java.util.concurrent.locks we have :…

CuriousMind
- 8,301
- 22
- 65
- 134
3
votes
1 answer
Postgres: SELECT blocks INSERT for an unrelated table
We are facing some database (postgres) issues at the moment and got to a point where the information we have doesn't lead to new insights. Hopefully, somebody can help us out here.
Some context
The tool we are working on is basically a generic…

Jesse
- 422
- 3
- 19
3
votes
1 answer
MySQL Row level locks
I am not sure about how the row level lock work but here is my problem
I have a table T (id int , balance int ) ( engine = InnoDB ) that I want to lock rows having ID = 1, so i start a transaction like this :
start transaction ;
select * from T…

Lilo
- 640
- 1
- 9
- 22
3
votes
1 answer
How to avoid pickling errors when sharing objects between threads?
I have a program in which I need to store a global variable into a file. I am doing this using the pickle module.
I have another thread(Daemon=False, from threading module) which sometimes changes the value of the global variable. The value is also…
user4340135
3
votes
3 answers
How to protect an object using a lock in Python?
I've come accross functionality which required the following pattern:
from threading import Lock
the_list = []
the_list_lock = Lock()
and to use it:
with the_list_lock:
the_list.append("New Element")
Unfortunately, this does not require me…

Georg Schölly
- 124,188
- 49
- 220
- 267
3
votes
1 answer
SQL Server database: INSERT query blocked with wait type LCK_M_IX
Our Java application cleans up the data from log table through a cron job. Here is the query which is executed for clean up:
DELETE FROM AU_TRANSACTIONDATA
WHERE AU_ACTIVITYENDTIME != 0
AND AU_ACTIVITYENDTIME <= 1464570001151
We have an index…

Aman
- 1,170
- 3
- 15
- 29
3
votes
2 answers
Threads - Unlocking lock using flags and try/finally
I'm trying to synchronize 3 threads. Each one of them handles a caterpillar that is moving along it's own path.
Unfortunately their paths are crossed like this:
To achieve this goal I'm using locks. There are two sections where blocks are shared:…

TomaszGrzybowski
- 41
- 3
3
votes
2 answers
Why python multiprocessing manager produce threading locks?
>>> import multiprocessing
>>> multiprocessing.Manager().Lock()
>>> type(multiprocessing.Lock())
Why the object produced by a manager is a thread.lock and not a…

azmeuk
- 4,026
- 3
- 37
- 64
3
votes
3 answers
Java Concurrent Exception
Hi I have a paint method that is drawing an image and I have another method that is constantly modifying the image to be drawn however I experience concurrency exceptions now and again. What is the most efficient way to resolve this please? I know I…

haz hazzz
- 103
- 2
- 8