condition-variable Questions
2
Solved
I'm probably missing something obvious, but I can't see any difference between std::condition_variable and std::condition_variable_any. Why do we need both?
Whiffet asked 6/1, 2012 at 13:14
4
Solved
(I think that) the consensus number for a mutex is 2.
What is the consensus number for semaphores (like in pthread_sem_*)?
What is the consensus number for condition variables (like in pthread_co...
Cran asked 21/4, 2009 at 15:34
3
According to POSIX,
It shall be safe to destroy an initialized condition variable upon which no threads are currently blocked.
Further, the signal and broadcast operations are specified to unb...
Pantograph asked 29/9, 2011 at 14:0
1
Solved
Does someone have an example of how to most easily use boost::condition::timed_wait? There are some threads on the topic here, here and here, but none feature a working example. And boost doc is as...
Otti asked 16/8, 2011 at 12:55
3
I am trying to make a windows-version of a program written for Linux, in C++. For the program to be thread-safe, I use pthread_cond_t and pthread_cond_wait in the Linux version. These functions use...
Atronna asked 29/7, 2011 at 10:51
1
Solved
The Linux Programming Interface book has a piece of code (producer/consumer) to show how condition variable works:
static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t con...
Monocoque asked 1/6, 2011 at 19:5
1
Solved
What are the principles of a condition variable in synchronization of the processes of operating systems?
Caloric asked 19/4, 2011 at 12:36
2
Solved
We can use either the new condition variable primitive or windows event in order to synchronize threads in WinNT v6.x or later. Consider the following two approaches, we want workers to run at the ...
Uzzial asked 8/3, 2011 at 14:18
2
Solved
Suppose some condition variable "cond" is associated with a mutex variable "mutex". If a thread is sleeping on cond after calling pthread_cond_wait(&cond,&mutex), and another thread that ha...
Cooks asked 3/3, 2011 at 1:4
1
Say we have a single-producer-thread single-consumer-thread lockless queue, and that the producer may go long periods without producing any data. It would be beneficial to let the consumer thread s...
Whiskey asked 21/11, 2010 at 0:12
2
I've known for eons that the way you use a condition variable is
lock
while not task_done
wait on condition variable
unlock
Because sometimes condition variables will spontaneously wake. But I'...
Nonmetallic asked 28/4, 2010 at 6:24
1
Solved
Here is the typical way to use a condition variable:
// The reader(s)
lock(some_mutex);
if(protected_by_mutex_var != desired_value)
some_condition.wait(some_mutex);
unlock(some_mutex);
// The wr...
Burstone asked 27/3, 2010 at 23:41
5
Solved
I'm trying to learn about condition variables. I would like to know what are the common situations where condition variables are used.
One example is in a blocking queue, where two threads access ...
Odd asked 19/3, 2010 at 9:45
1
Solved
I'm trying to learn about condition variables and how to use it in a producer-consumer situation. I have a queue where one thread pushes numbers into the queue while another thread popping numbers ...
Ramiroramjet asked 4/3, 2010 at 14:5
© 2022 - 2024 — McMap. All rights reserved.