PTHREAD_COND_WAIT(3) BSD Library Functions Manual PTHREAD_COND_WAIT(3)NAME
pthread_cond_wait -- wait on a condition variable
LIBRARY
POSIX Threads Library (libpthread, -lpthread)
SYNOPSIS
#include <pthread.h>
int
pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
DESCRIPTION
The pthread_cond_wait() function atomically blocks the current thread waiting on the condition variable specified by cond, and releases the
mutex specified by mutex. The waiting thread unblocks only after another thread calls pthread_cond_signal(3), or pthread_cond_broadcast(3)
with the same condition variable, and the current thread reacquires the lock on mutex.
RETURN VALUES
If successful, the pthread_cond_wait() function will return zero. Otherwise an error number will be returned to indicate the error.
ERRORS
The pthread_cond_wait() function will fail if:
[EINVAL] The value specified by cond or the value specified by mutex is invalid.
[EPERM] The specified mutex was not locked by the calling thread.
SEE ALSO pthread_cond_broadcast(3), pthread_cond_destroy(3), pthread_cond_init(3), pthread_cond_signal(3), pthread_cond_timedwait(3)STANDARDS
The pthread_cond_wait() function conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').
BSD February 16, 2006 BSD
Check Out this Related Man Page
PTHREAD_COND_WAIT(3) BSD Library Functions Manual PTHREAD_COND_WAIT(3)NAME
pthread_cond_wait -- wait on a condition variable
SYNOPSIS
#include <pthread.h>
int
pthread_cond_wait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex);
DESCRIPTION
The pthread_cond_wait() function atomically unlocks the mutex and blocks the current thread on the condition specified by the cond argument.
The current thread unblocks only after another thread calls pthread_cond_signal(3) or pthread_cond_broadcast(3) with the same condition vari-
able. The mutex must be locked before calling this function, otherwise the behavior is undefined. Before pthread_cond_wait() returns to the
calling function, it re-acquires the mutex.
RETURN VALUES
If successful, the pthread_cond_wait() function will return zero; otherwise, an error number will be returned to indicate the error.
ERRORS
pthread_cond_wait() will fail if:
[EINVAL] The value specified by cond or the value specified by mutex is invalid.
SEE ALSO pthread_cond_broadcast(3), pthread_cond_destroy(3), pthread_cond_init(3), pthread_cond_signal(3), pthread_cond_timedwait(3)STANDARDS
pthread_cond_wait() conforms to ISO/IEC 9945-1:1996 (``POSIX.1'').
Darwin November 5, 2001 Darwin
Is it possible that the function "pthread_cond_broadcast" block itself and the function "pthread_cond_wait" unblock in multi-threads programming ? The operating system is AIX 5.2, its maintenance level is : 5.2.0.4, VisualAge C++ 6.0.
Thanks (0 Replies)
hello,
in my free time i am writing on a c++ mud codebase, a while ago i decided that i would move to pthreads, so i could make use of smp. now i have a problem which i just cant fix - for weeks now. i have a main thread which spawns my threads, as soon as spawned they get a pthread_cond_wait, so... (4 Replies)
Please tell me about internal functionality of pthread_cond_wait(). How it works.
Whether it actually put the thread into sleep and do the context switch or use spin locking. (1 Reply)
Hello,
I have got some issue with the struct variable with passed arguments
the variable in the sturct is only recognize the last value their assigned to
I'm pretty confused why the mutex didn't work out
here is my program:
#include<stdio.h>
#include<pthread.h>
pthread_mutex_t lock... (3 Replies)
Hi,
I have a module by the name gateway, and it core dumps and gives a cma_dump.log file which says:
%Internal DCE Threads problem (version CMA BL10+), terminating execution.
% Reason: dispatch: no available VP (uniprocessor)
The current thread is 3 (address 0x40107c40)
DECthreads... (0 Replies)
looking in pthread's source code I can see that as an epilogue both pthread_cond_timedwait and pthread_cond_wait will try to relock the mutex by means of __pthread_mutex_cond_lock.
Does this mean that any of them both could eventually block forever if the mutex is never again available after... (4 Replies)
When i try to make my c project i am getting an error message like this : ../../../lib/linux/libxml.so: undefined reference to `pthread_cond_signal@GLIBC_2.3.2'
Please help me in resolving this. (0 Replies)
When more than one thread is waiting for a locked mutex, which thread will be granted the lock first after it is released.
In our application we want to implement FIFO thread scheduling policy i.e. Thread should get lock which one requested first for it.
AIX have SCHED_FIFO thread scheduling... (1 Reply)