/usr/include/pthread.h is missing a closing } in pthread_cleanup_push it reads: #define pthread_cleanup_push(routine,arg) \ { struct _pthread_cleanup_buffer _buffer; \ _pthread_cleanup_push (&_buffer, (routine), (arg)); and should read: #define pthread_cleanup_push(routine,arg) \ { struct _pthread_cleanup_buffer _buffer; \ _pthread_cleanup_push (&_buffer, (routine), (arg)); } the absence of this closing } leads to hard to find compile-errors. --phil.
The compile errors are desirable, quoting pthread.h: /* Install a cleanup handler: ROUTINE will be called with arguments ARG when the thread is cancelled or calls pthread_exit. ROUTINE will also be called with arguments ARG when the matching pthread_cleanup_pop is executed with non-zero EXECUTE argument. pthread_cleanup_push and pthread_cleanup_pop are macros and must always be used in matching pairs at the same nesting level of braces. */