Top "Mutex" questions

A mutex ("mutual exclusion") is a mechanism to ensure integrity when the same data or resource is accessed (in particular, changed) concurrently from several threads.

Synchronising twice on the same object?

I was wondering if in Java I would get any odd behaviour if I synchronise twice on the same object? …

java multithreading synchronization mutex
What are the practical uses of semaphores?

Nonbinary ones.. I have never encountered a problem that required me to use a semaphore instead of mutex. So is …

mutex semaphore
Why doesn't Mutex get released when disposed?

I have the following code: using (Mutex mut = new Mutex(false, MUTEX_NAME)) { if (mut.WaitOne(new TimeSpan(0, 0, 30))) { // Some code …

c# .net mutex
Locking C++11 std::unique_lock causes deadlock exception

I'm trying to use a C++11 std::condition_variable, but when I try to lock the unique_lock associated with …

linux multithreading c++11 mutex condition-variable
Detecting if another instance of the application is already running

My application needs to behave slightly differently when it loads if there is already an instance running. I understand how …

c# visual-studio-2008 mutex multiple-instances
How should I deal with mutexes in movable types in C++?

By design, std::mutex is not movable nor copyable. This means that a class A holding a mutex won't receive …

c++ mutex move-constructor
How can I create a smart pointer that locks and unlocks a mutex?

I have a threaded class from which I would like to occasionally acquire a pointer an instance variable. I would …

c++ thread-safety mutex smart-pointers raii
How can I synchronize two processes accessing a file on a NAS?

Here's the thing: I have two applications, written in C++ and running on two machines with different OS (one Linux …

c++ concurrency synchronization mutex nas
Plural form of word "mutex"

What is the correct plural form of the portmanteau mutex. Is it mutexes or mutices?

mutex
Use std::lock_guard with try_lock

Is there a way I can tell std::lock_guard to call try_lock instead of lock when it acquires …

c++ multithreading c++11 mutex