-
as seen on Stack Overflow
- Search for 'Stack Overflow'
The documentation for the .NET Semaphore class states that:
There is no guaranteed order, such as FIFO or LIFO, in which blocked threads enter the semaphore.
In this case, if I want a guaranteed order (either FIFO or LIFO), what are my options? Is this something that just isn't easily possible…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I have created a "Manager" class that contains a limited set of resources. The resources are stored in the "Manager" as a Queue. I initialize the Queue and a Semaphore to the same size, using the semaphore to block a thread if there are no resources available. I have multiple threads calling into…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I want to write a command line utility that can be used to synchronize the execution off programs in different consoles.
Console A:
$ first_program && semaphore -signal
Console B:
$ semaphore -wait && second_program
The first program takes a long take to complete. The second program…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Suppose I write a C++ semaphore class with an interface that models the boost Lockable concept (i.e. lock(); unlock(); try_lock(); etc.). Is it safe/recommended to use boost locks for RAII access to such an object? In other words, do boost locks (and/or other related parts of the boost thread library)…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hi
In previous question of mine, someone had meantioned that using Semaphores were expensive in C# compared to using a monitor. So I ask this, how can I replace the semaphore in this code with a monitor?
I need function1 to return its value after function2 (in a separate thread) has been completed…
>>> More