About 381,000 results
Open links in new tab
  1. multithreading - What is a semaphore? - Stack Overflow

    Aug 29, 2008 · A semaphore is a programming concept that is frequently used to solve multi-threading problems. My question to the community: What is a semaphore and how do you use it?

  2. What is the difference between lock, mutex and semaphore?

    Feb 25, 2010 · I've heard these words related to concurrent programming, but what's the difference between lock, mutex and semaphore?

  3. Understanding Semaphores in C# - Stack Overflow

    Dec 23, 2021 · I am trying to understand a section of code written in C#: static Semaphore _transactionReceived; static TransactionsSession _transactionsSession; static void …

  4. Need to understand the usage of SemaphoreSlim - Stack Overflow

    Here is the code I have but I don't understand what SemaphoreSlim is doing. async Task WorkerMainAsync() { SemaphoreSlim ss = new SemaphoreSlim(10); List<Task> trackedTasks …

  5. Difference between binary semaphore and mutex - Stack Overflow

    Is there any difference between a binary semaphore and mutex or are they essentially the same?

  6. multithreading - Semaphores on Python - Stack Overflow

    Jul 20, 2015 · I've started programming in Python a few weeks ago and was trying to use Semaphores to synchronize two simple threads, for learning purposes. Here is what I've got: import threading sem …

  7. Semaphore Wait vs WaitAsync in an async method - Stack Overflow

    Jun 1, 2017 · I'm trying to find out what is the difference between the SemaphoreSlim use of Wait and WaitAsync, used in this kind of context: private SemaphoreSlim semaphore = new …

  8. c++ - Why use a mutex and not a semaphore? - Stack Overflow

    Apr 27, 2025 · There are differences between a std::binary_semaphore and a std::mutex which are mentioned in the cppreference documentation (under the Notes section): Unlike std::mutex a …

  9. c++ - Semaphore Vs Mutex - Stack Overflow

    Apr 5, 2017 · I was reading a bit of Mutex and semaphore. I have piece of code int func() { i++; return i; } i is declared somewhere outside as a global variable. If i create counting semaphore with count a...

  10. What are the advantages of using `lock` over `SemaphoreSlim`?

    Nov 21, 2022 · Here are the advantages of the lock over the SemaphoreSlim: The lock is reentrant, while the SemaphoreSlim is not. So programming with the lock is more forgiving. In case there is a …