Mac OS X の pthread_cond_timedwait は壊れているという話
http://lists.apple.com/archives/darwin-dev/2005/Jun/msg00174.html
手元の環境 (10.4.11) でも -m64 だとハングする。
$ gcc -Wall testtimedwait.c -lpthread $ ./a.out timedwait done $ gcc -m64 -Wall testtimedwait.c -lpthread $ ./a.out (何もおこらないまま)
testtimedwait.c は以下のとおり。
#include <stdio.h> #include <pthread.h> int main(int argc, char **argv) { pthread_mutex_t mutex; pthread_cond_t cond; struct timespec ts = { time(NULL), 0 }; pthread_mutex_init(&mutex, NULL); pthread_cond_init(&cond, NULL); pthread_cond_timedwait(&cond, &mutex, &ts); printf("timedwait done\n"); pthread_cond_destroy(&cond); pthread_mutex_destroy(&mutex); return 0; }
ぶつくさ。