Top "Locking" questions

Locking allows different types of resources to be used exclusively by one process at a time.

Spinlocks, How Useful Are They?

How often do you find yourself actually using spinlocks in your code? How common is it to come across a …

c# c++ multithreading locking spinlock
Perforce File Locked By Departed User

I have a file that is locked/checked out exclusively by a user who is no longer with the company. …

locking perforce
Mysql - Serialization failure: 1213 Deadlock found when try to get lock; try restarting transaction

I have menus, categories and products tables. I am using mysql 5.5, All tables are innoDB and in all cases id …

mysql locking database-deadlocks table-locking
Java thread dump: Difference between "waiting to lock" and "parking to wait for"?

In a Java thread dump, you can see locks mentioned within stack traces. There seems to be three kinds of …

java multithreading locking jvm thread-dump
Optimistic Locking by concrete (Java) example

I have spent my morning reading all the top articles that Google churns up on optimistic locking, and for the …

java concurrency locking optimistic-locking
How to solve the "Double-Checked Locking is Broken" Declaration in Java?

I want to implement lazy initialization for multithreading in Java. I have some code of the sort: class Foo { private …

java multithreading concurrency locking lazy-loading
Reading interlocked variables

Assume: A. C++ under WIN32. B. A properly aligned volatile integer incremented and decremented using InterlockedIncrement() and InterlockedDecrement(). __declspec (align(8)) …

c++ windows multithreading locking interlocked
+[CATransaction synchronize] called within transaction

If I close my iPad app while I'm loading data from services, the app closes but then immediately opens again …

ios ipad locking catransaction
Would you explain lock ordering?

I learned that I should unlock reverse order to lock order. For example. A.lock(); B.lock(); B.unlock(); A.…

concurrency locking deadlock
What does "synchronized" exactly do? Lock a function or lock an objects function?

I am wondering how exactly "synchronized" works in java. Let's say I model a board-game that consists of a number …

java multithreading locking synchronized