32 #ifndef SCHEDULER_LOCKS_H 33 #define SCHEDULER_LOCKS_H 41 #define LOCKRET(func) do { \ 43 if ( (err=(func)) != 0) \ 44 ods_log_error("%s at %d could not " #func ": %s", \ 45 __FILE__, __LINE__, strerror(err)); \ 48 #if defined(HAVE_PTHREAD) 53 #define ODS_MINIMUM_STACKSIZE 524288 58 typedef pthread_cond_t cond_basic_type;
61 #define lock_basic_init(lock) LOCKRET(pthread_mutex_init(lock, NULL)) 62 #define lock_basic_destroy(lock) LOCKRET(pthread_mutex_destroy(lock)) 63 #define lock_basic_lock(lock) LOCKRET(pthread_mutex_lock(lock)) 64 #define lock_basic_unlock(lock) LOCKRET(pthread_mutex_unlock(lock)) 67 #define lock_basic_set(cond) LOCKRET(pthread_cond_init(cond, NULL)) 68 #define lock_basic_sleep(cond, lock, sleep) LOCKRET(ods_thread_wait(cond, lock, sleep)) 69 #define lock_basic_alarm(cond) LOCKRET(pthread_cond_signal(cond)) 70 #define lock_basic_broadcast(cond) LOCKRET(pthread_cond_broadcast(cond)) 71 #define lock_basic_off(cond) LOCKRET(pthread_cond_destroy(cond)) 73 int ods_thread_wait(cond_basic_type* cond,
lock_basic_type* lock, time_t wait);
78 #define ods_thread_detach(thr) LOCKRET(pthread_detach(thr)) 79 #define ods_thread_self() pthread_self() 80 #define ods_thread_join(thr) LOCKRET(pthread_join(thr, NULL)) 81 #define ods_thread_kill(thr, sig) LOCKRET(pthread_kill(thr, sig)) 83 int ods_thread_wait(cond_basic_type* cond,
lock_basic_type* lock, time_t wait);
89 #define PTHREADS_DISABLED 1 92 #define lock_basic_init(lock) 93 #define lock_basic_destroy(lock) 94 #define lock_basic_lock(lock) 95 #define lock_basic_unlock(lock) 97 #define lock_basic_set(cond) 98 #define lock_basic_sleep(cond, lock, sleep) 99 #define lock_basic_alarm(cond) 100 #define lock_basic_broadcast(cond) 101 #define lock_basic_off(cond) 104 #define ods_thread_create(thr, func, arg) ods_thr_fork_create(thr, func, arg) 105 #define ods_thread_detach(thr) 106 #define ods_thread_self() getpid() 107 #define ods_thread_join(thr) ods_thr_fork_wait(thr) void ods_thread_blocksigs(void)
void ods_thr_fork_create(ods_thread_type *thr, void *(*func)(void *), void *arg)
void ods_thr_fork_wait(ods_thread_type thread)
#define ods_thread_create(thr, func, arg)