Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pthread_cond_wait(3) [freebsd man page]

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 *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. 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''). Darwin February 16, 2006 Darwin
Man Page

8 More Discussions You Might Find Interesting

1. AIX

pthread lock question

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)
Discussion started by: Frank2004
0 Replies

2. Programming

help me out with my threaded c++ mudbase - c++, pthread_cond_wait

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)
Discussion started by: sonicx
4 Replies

3. Programming

Conditional wait using pthread_cond_wait() details

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)
Discussion started by: mansoorulhaq
1 Replies

4. Programming

pthread and mutex question

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)
Discussion started by: michael23
3 Replies

5. HP-UX

%Internal DCE Threads problem (version CMA BL10+)

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)
Discussion started by: vanz
0 Replies

6. Programming

pthread_cond_timedwait relocks forever

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)
Discussion started by: ramestica
4 Replies

7. UNIX for Dummies Questions & Answers

Undefined reference to `pthread_cond_signal@GLIBC_2.3.2

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)
Discussion started by: dhivyam
0 Replies

8. Programming

pthread locking and unlocking.

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)
Discussion started by: mukind
1 Replies