/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: bing.wei.liu REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. * Test that pthread_cond_signal() * shall unblock at least one of the threads currently blocked on * the specified condition variable cond. */ #define _XOPEN_SOURCE 600 #include #include #include #include #include #include "posixtest.h" #define THREAD_NUM 3 struct testdata { pthread_mutex_t mutex; pthread_cond_t cond; } td; pthread_t thread[THREAD_NUM]; int start_num = 0; int waken_num = 0; /* Alarm handler */ void alarm_handler(int signo) { int i; printf("Error: failed to wakeup all threads\n"); for (i=0; i= THREAD_NUM) { fprintf(stderr,"[Main thread] had to signal the condition %i times\n", i+1); fprintf(stderr,"[Main thread] to wake up %i threads\n. Test FAILED.\n", THREAD_NUM); exit(PTS_FAIL); } /* join all secondary threads */ for (i=0; i