Lines Matching refs:semaphore
30 * threads that are waiting on a single semaphore, and not all of
35 #include <semaphore.h>
41 static sem_t semaphore;
43 /* Thread function, just wait for the semaphore */
63 * this is used to exercize more of the semaphore code path */
64 if ( sem_init( &semaphore, 0, 1 ) < 0 ) {
65 printf( "Could not initialize semaphore: %s\n", strerror(errno) );
70 if ( pthread_create( &t[nn], NULL, thread_func, &semaphore ) < 0 ) {
78 sem_post(&semaphore);
89 if (sem_getvalue(&semaphore, &value) < 0) {
90 printf("Could not get semaphore value: %s\n", strerror(errno));
94 printf("Error: Semaphore value = %d\n", value);