2010-09-21 14:22:38 +02:00
|
|
|
#ifndef __MTHREAD_PROTO_H__
|
|
|
|
#define __MTHREAD_PROTO_H__
|
|
|
|
|
2010-09-30 15:44:13 +02:00
|
|
|
/* allocate.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
mthread_tcb_t * mthread_find_tcb(mthread_thread_t thread);
|
|
|
|
void mthread_thread_reset(mthread_thread_t thread);
|
2010-09-30 15:44:13 +02:00
|
|
|
|
2010-09-21 14:22:38 +02:00
|
|
|
/* attribute.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
void mthread_init_valid_attributes(void);
|
2010-09-21 14:22:38 +02:00
|
|
|
#ifdef MDEBUG
|
2012-03-24 16:16:34 +01:00
|
|
|
int mthread_attr_verify(void);
|
2010-09-21 14:22:38 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* cond.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
void mthread_init_valid_conditions(void);
|
2010-09-21 14:22:38 +02:00
|
|
|
#ifdef MDEBUG
|
2012-03-24 16:16:34 +01:00
|
|
|
int mthread_cond_verify(void);
|
2010-09-21 14:22:38 +02:00
|
|
|
#endif
|
|
|
|
|
2011-04-14 13:54:43 +02:00
|
|
|
/* key.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
void mthread_init_keys(void);
|
|
|
|
void mthread_cleanup_values(void);
|
2011-04-14 13:54:43 +02:00
|
|
|
|
2010-09-21 14:22:38 +02:00
|
|
|
/* misc.c */
|
2011-07-27 11:30:26 +02:00
|
|
|
#ifdef MDEBUG
|
2010-09-21 14:22:38 +02:00
|
|
|
#define mthread_panic(m) mthread_panic_f(__FILE__, __LINE__, (m))
|
2012-03-24 16:16:34 +01:00
|
|
|
void mthread_panic_f(const char *file, int line, const char *msg);
|
2010-09-21 14:22:38 +02:00
|
|
|
#define mthread_debug(m) mthread_debug_f(__FILE__, __LINE__, (m))
|
2012-03-24 16:16:34 +01:00
|
|
|
void mthread_debug_f(const char *file, int line, const char *msg);
|
2011-07-27 11:30:26 +02:00
|
|
|
#else
|
2012-03-24 16:16:34 +01:00
|
|
|
void mthread_panic_s(void);
|
2011-07-27 11:30:26 +02:00
|
|
|
# define mthread_panic(m) mthread_panic_s()
|
|
|
|
# define mthread_debug(m)
|
|
|
|
#endif
|
2010-09-21 14:22:38 +02:00
|
|
|
|
|
|
|
/* mutex.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
void mthread_init_valid_mutexes(void);
|
2011-03-18 11:29:54 +01:00
|
|
|
|
|
|
|
#ifdef MTHREAD_STRICT
|
2012-03-24 16:16:34 +01:00
|
|
|
int mthread_mutex_valid(mthread_mutex_t *mutex);
|
2012-05-01 11:44:49 +02:00
|
|
|
# define MTHREAD_CHECK_INIT() mthread_init()
|
2011-03-18 11:29:54 +01:00
|
|
|
#else
|
|
|
|
# define mthread_mutex_valid(x) ((*x)->mm_magic == MTHREAD_INIT_MAGIC)
|
2012-05-01 11:44:49 +02:00
|
|
|
# define MTHREAD_CHECK_INIT()
|
2011-03-18 11:29:54 +01:00
|
|
|
#endif
|
|
|
|
|
2010-09-21 14:22:38 +02:00
|
|
|
#ifdef MDEBUG
|
2012-03-24 16:16:34 +01:00
|
|
|
int mthread_mutex_verify(void);
|
2010-09-21 14:22:38 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* schedule.c */
|
2012-03-24 16:16:34 +01:00
|
|
|
int mthread_getcontext(ucontext_t *ctxt);
|
|
|
|
void mthread_init_scheduler(void);
|
|
|
|
void mthread_schedule(void);
|
|
|
|
void mthread_suspend(mthread_state_t state);
|
|
|
|
void mthread_unsuspend(mthread_thread_t thread);
|
2010-09-21 14:22:38 +02:00
|
|
|
|
|
|
|
/* queue.c */
|
2011-07-27 11:30:26 +02:00
|
|
|
#ifdef MDEBUG
|
2012-03-24 16:16:34 +01:00
|
|
|
void mthread_dump_queue(mthread_queue_t *queue);
|
2011-07-27 11:30:26 +02:00
|
|
|
#endif
|
2012-03-24 16:16:34 +01:00
|
|
|
void mthread_queue_init(mthread_queue_t *queue);
|
|
|
|
void mthread_queue_add(mthread_queue_t *queue, mthread_thread_t thread);
|
|
|
|
mthread_thread_t mthread_queue_remove(mthread_queue_t *queue);
|
|
|
|
int mthread_queue_isempty(mthread_queue_t *queue);
|
2010-09-21 14:22:38 +02:00
|
|
|
|
|
|
|
#endif
|