home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Thread Header
- */
-
- #include <sys/types.h>
-
- #include <exec/ports.h>
- #include <exec/tasks.h>
-
- #ifndef AMSTER_THREAD_H
- #define AMSTER_THREAD_H
-
- extern u_long th_sigmask;
-
- typedef void (*thcb)(struct thread_struct *t, int com, APTR data);
-
- typedef struct thmsg_struct
- {
- struct Message header;
- struct thread_struct *sender;
- int com;
- APTR data;
- int isreply;
- } *thmsg, _thmsg;
-
- typedef struct thread_struct
- {
- struct thread_struct *next;
- struct Task *task;
- struct MsgPort *port;
- struct MsgPort *mother;
- struct Task *mother_task;
- thcb handler;
- APTR data;
- _thmsg sm;
- _thmsg em;
- } *thread, _thread;
-
- enum thread_state {
- THC_STARTUP = -1,
- THC_EXIT = -2,
- THC_FINISH = -3
- };
-
-
- extern int th_init(void);
- extern void th_exit(void);
-
- extern thread th_spawn(thcb handler, char *name, void (*func)(void), int pri, APTR data);
- extern void th_message(thread t, int com, APTR data);
- extern void th_poll(void);
-
- /* following functions are called from threads */
- extern thread thr_init(void);
- extern void thr_exit(thread t, int reason);
- extern void thr_message(thread t, int com, APTR data);
-
-
-
- #endif /* AMSTER_THREAD_H */
-