39 #ifdef HAVE_SYS_TIME_H
46 static const char* lock_str =
"lock";
48 #if !defined(HAVE_PTHREAD)
50 #include <sys/types.h>
92 if (waitpid((pid_t)thread, &status, 0) == -1) {
98 lock_str, (
int)thread, status);
106 ods_thread_wait(cond_basic_type* cond,
lock_basic_type* lock, time_t wait)
114 #ifndef HAVE_CLOCK_GETTIME
116 if (gettimeofday(&tv, NULL) != 0) {
121 ts.tv_sec = tv.tv_sec;
122 ts.tv_nsec = (tv.tv_usec/1000);
124 if (clock_gettime(CLOCK_REALTIME, &ts) < 0) {
132 ts.tv_sec = ts.tv_sec + wait;
133 ret = pthread_cond_timedwait(cond, lock, &ts);
135 ret = pthread_cond_wait(cond, lock);
138 if (ret == ETIMEDOUT) {
157 if((err=pthread_sigmask(SIG_SETMASK, &sigset, NULL)))
158 ods_fatal_exit(
"[%s] pthread_sigmask: %s", lock_str, strerror(err));
161 if(sigprocmask(SIG_SETMASK, &sigset, NULL) != 0)
162 ods_fatal_exit(
"[%s] sigprocmask: %s", lock_str, strerror(errno));
void ods_thread_blocksigs(void)
void ods_thr_fork_create(ods_thread_type *thr, void *(*func)(void *), void *arg)
void ods_fatal_exit(const char *format,...)
void ods_log_error(const char *format,...)
void ods_log_warning(const char *format,...)
void ods_thr_fork_wait(ods_thread_type thread)