1 #ifndef __MTHREAD_PROTO_H__ 2 #define __MTHREAD_PROTO_H__ 3 4 /* allocate.c */ 5 mthread_tcb_t * mthread_find_tcb(mthread_thread_t thread); 6 void mthread_thread_reset(mthread_thread_t thread); 7 8 /* attribute.c */ 9 void mthread_init_valid_attributes(void); 10 #ifdef MDEBUG 11 int mthread_attr_verify(void); 12 #endif 13 14 /* cond.c */ 15 void mthread_init_valid_conditions(void); 16 #ifdef MDEBUG 17 int mthread_cond_verify(void); 18 #endif 19 20 /* key.c */ 21 void mthread_init_keys(void); 22 void mthread_cleanup_values(void); 23 24 /* misc.c */ 25 #ifdef MDEBUG 26 #define mthread_panic(m) mthread_panic_f(__FILE__, __LINE__, (m)) 27 void mthread_panic_f(const char *file, int line, const char *msg); 28 #define mthread_debug(m) mthread_debug_f(__FILE__, __LINE__, (m)) 29 void mthread_debug_f(const char *file, int line, const char *msg); 30 #else 31 __dead void mthread_panic_s(void); 32 # define mthread_panic(m) mthread_panic_s() 33 # define mthread_debug(m) 34 #endif 35 36 /* mutex.c */ 37 void mthread_init_valid_mutexes(void); 38 39 #ifdef MTHREAD_STRICT 40 int mthread_mutex_valid(mthread_mutex_t *mutex); 41 #else 42 # define mthread_mutex_valid(x) ((*x)->mm_magic == MTHREAD_INIT_MAGIC) 43 #endif 44 45 #ifdef MDEBUG 46 int mthread_mutex_verify(void); 47 #endif 48 49 /* schedule.c */ 50 int mthread_getcontext(ucontext_t *ctxt); 51 void mthread_init_scheduler(void); 52 void mthread_schedule(void); 53 void mthread_suspend(mthread_state_t state); 54 void mthread_unsuspend(mthread_thread_t thread); 55 56 /* queue.c */ 57 #ifdef MDEBUG 58 void mthread_dump_queue(mthread_queue_t *queue); 59 #endif 60 void mthread_queue_init(mthread_queue_t *queue); 61 void mthread_queue_add(mthread_queue_t *queue, mthread_thread_t thread); 62 mthread_thread_t mthread_queue_remove(mthread_queue_t *queue); 63 int mthread_queue_isempty(mthread_queue_t *queue); 64 65 #endif 66