Unfortunately, there is no Semaphore in System.Threading when using the .NET Compact Framework.
I'm not sure why that is, does anyone have an idea?
After googling I've found a bunch of people giving their own implementations, but none of them really worked great... or at all!
So I've come to ask the experts...
Does anyone have a good...
I'm porting a Windows application to Linux and I have a synchronization problem.
In Windows I'm using a system-level named mutex to sync access to a shared memory block.
How do I emulate that in Linux? I've created a SystemV semaphore, using semget. The problem is that it is not reentrant, if I already hold it it will block, unlike on ...
Is it possible to use fcntl() system call on a file to achieve thread/process synchronization (instead of semaphoress)?
...
Hi,
We're seeing odd behaviour on RedHat Enterprise Linux systems with pthreads sem_timedwait. It's only occurring with versions 5.3 onwards.
When we create the semaphore on a background thread with sem_init, no error is returned. When we do sem_timedwait, we get an immediate return with errno = 38 (ENOSYS) indicating it's not suppor...
I'm looking for a fast and efficient implementation of a Semaphore for the .NET Compact Framework. There has been another Question here on SO (Semaphores in .NET compact framework) in which it was suggested to use P/Invoke, but this is not possible in the XNA Framework running on the XBox 360.
I can offer two implementations of my own, ...
When dealing with threads (specifically in C++) using mutex locks and semaphores is there a simple rule of thumb to avoid Dead Locks and have nice clean Synchronization?
...
There are two queues of children waiting to use a roundabout in a playground – one is facing it from the north, one from the south. Children may only enter the roundabout from the front of either queue and may only enter if there is a space available (only one child may use each segment at a time). Once on the roundabout they use it for ...
Hi. Is it possible to query a semaphore created with sem_get without actually blocking like the sem_acquire function does?
Cheers,
Dan.
...
Can every imaginable synchronization problem be solved with judicious use of semaphores? What about weak semaphores?
...
Perhaps it's too late at night, but I can't think of a nice way to do this.
I've started a bunch of asynchronous downloads, and I want to wait until they all complete before the program terminates. This leads me to believe I should increment something when a download starts, at decrement it when it finishes. But then how do I wait until...
What do I need and how can I use threads in C on Windows Vista?
Could you please give me a simple code example?
...
After switching from Ubuntu to CentOS 5.4 we came across a strange GDB behavior. Running application in debugger causes sem_wait() to return several (5-10) times with EINTR error.
I installed the latest GDB version but it did not solve the problem.
I suppose this is cause by some signal sent by GDB but I could not get any info in signal ...
Hi, all
I'm writing a program with two processes operate on a semaphore in the ping-pong mode. The program first calls semget() to acquire a semaphore of size 2, semaphore #0 is initialized with value 1 while semaphore #1 is initialized with value 0. The code is as following:
#include <sys/types.h>
#include <unistd.h>
#include <stdlib....
I have multiple apps compiled with g++, running in Ubuntu. I'm using named semaphores to co-ordinate between different processes.
All works fine except in the following situation: If one of the processes calls sem_wait() or sem_timedwait() to decrement the semaphore and then crashes or is killed -9 before it gets a chance to call sem_...
How can I use threads in Ada95? What functions can I use to create, destroy, stop and start them?
How can I use semaphores in this language?
...
The usual pattern for a ReadWriteMutex is to use a semaphore and have the writer loop to acquire all the resources:
inline void write_lock() {
ScopedLock lock(acquire_mutex_);
for (size_t i=0; i < resource_count_; ++i) {
if (sem_wait(semaphore_) < 0) {
fprintf(stderr, "Could not acquire semaphore (%s)\n", strerror(errno));...
how can i delete all NOT USED semaphores and shared memory with a single command in ubuntu??
...
Hello All
I have a problem with messaging (with MSMQ) which is a variation of fast producer/slow consumer. Is there a way to get outstanding unconsumed message count in a private MSMQ queue? I would like to use that to throttle the producer.
I would like to use a semaphore paradigm with MSMQ where the producer application will only s...
The following code runs perfectly well on my XP SP2 machine, but the call to WaitForSingleObject waits indefinitely when running on my Vista machine:
HANDLE ghSemaphore;
ghSemaphore = CreateSemaphore(NULL, 0, 1, "COM_PHILOERTEL_FINA");
if (ghSemaphore == NULL) {
MessageBoxA(NULL,"Error creating semaphore","ERROR",0);
return FALSE;
}
...
Dear Gurus
I had a requirement to allocate the resource to number of threads so i used semaphores to handle all this then i realized that semaphore are used in case of Interprocess locking of resources. I googled and found some implementation of In-Process Semaphore and used that class but it has some weird bugs.
Now my question is Sh...