pthreads

Timeout based concurrent queue in C++

I am trying to develop a concurrent queue using POSIX threads + C++ with the following semantics: Some threads may call push(item, timeout) and if the addition of the element does not happen by time timeout it must be rejected. Some threads may call pop(item, timeout) and again if deletion of the element does not happen by time timeou...

Creating multiple threads and invoking other exectuables in Cygwin through system()?

I am working on a project in Cygwin. In an attempt to create multiple threads in C, and each thread calls another executable through the command line using the system() function, it turns out things are not working properly. Specifically, the code I have is like this: #include <pthread.h> #include <stdio.h> #define NUM_THREADS 5 vo...

Can 2 pthread condition variables share the same mutex?

I went through the documentation in http://www.opengroup.org/onlinepubs/009695399/functions/pthread_cond_wait.html but this is not mentioned explicitly. Any prompt response will be very appreciated. ...