Subversion Repositories HelenOS-historic

Rev

Rev 1156 | Rev 1171 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1156 Rev 1158
Line 36... Line 36...
36
#include <arch/types.h>
36
#include <arch/types.h>
37
#include <typedefs.h>
37
#include <typedefs.h>
38
#include <time/timeout.h>
38
#include <time/timeout.h>
39
#include <synch/rwlock.h>
39
#include <synch/rwlock.h>
40
#include <config.h>
40
#include <config.h>
-
 
41
#include <adt/btree.h>
41
#include <adt/list.h>
42
#include <adt/list.h>
42
#include <mm/slab.h>
43
#include <mm/slab.h>
43
#include <proc/uarg.h>
44
#include <proc/uarg.h>
44
 
45
 
45
#define THREAD_STACK_SIZE   STACK_SIZE
46
#define THREAD_STACK_SIZE   STACK_SIZE
Line 63... Line 64...
63
/** Thread structure. There is one per thread. */
64
/** Thread structure. There is one per thread. */
64
struct thread {
65
struct thread {
65
    link_t rq_link;             /**< Run queue link. */
66
    link_t rq_link;             /**< Run queue link. */
66
    link_t wq_link;             /**< Wait queue link. */
67
    link_t wq_link;             /**< Wait queue link. */
67
    link_t th_link;             /**< Links to threads within containing task. */
68
    link_t th_link;             /**< Links to threads within containing task. */
68
    link_t threads_link;            /**< Link to the list of all threads. */
-
 
69
   
69
   
70
    /** Lock protecting thread structure.
70
    /** Lock protecting thread structure.
71
     *
71
     *
72
     * Protects the whole thread structure except list links above.
72
     * Protects the whole thread structure except list links above.
73
     * Must be acquired before T.lock for each T of type task_t.
73
     * Must be acquired before T.lock for each T of type task_t.
Line 128... Line 128...
128
 * Must be acquired before T.lock for each T of type thread_t.
128
 * Must be acquired before T.lock for each T of type thread_t.
129
 *
129
 *
130
 */
130
 */
131
extern spinlock_t threads_lock;
131
extern spinlock_t threads_lock;
132
 
132
 
133
extern link_t threads_head;         /**< List of all threads in the system. */
133
extern btree_t threads_btree;           /**< B+tree containing all threads. */
134
 
134
 
135
extern void thread_init(void);
135
extern void thread_init(void);
136
extern thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags, char *name);
136
extern thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags, char *name);
137
extern void thread_ready(thread_t *t);
137
extern void thread_ready(thread_t *t);
138
extern void thread_exit(void);
138
extern void thread_exit(void);
Line 141... Line 141...
141
extern void thread_usleep(__u32 usec);
141
extern void thread_usleep(__u32 usec);
142
 
142
 
143
extern void thread_register_call_me(void (* call_me)(void *), void *call_me_with);
143
extern void thread_register_call_me(void (* call_me)(void *), void *call_me_with);
144
extern void thread_print_list(void);
144
extern void thread_print_list(void);
145
extern void thread_destroy(thread_t *t);
145
extern void thread_destroy(thread_t *t);
-
 
146
extern bool thread_exists(thread_t *t);
146
 
147
 
147
/* Fpu context slab cache */
148
/* Fpu context slab cache */
148
extern slab_cache_t *fpu_context_slab;
149
extern slab_cache_t *fpu_context_slab;
149
 
150
 
150
/** Thread syscall prototypes. */
151
/** Thread syscall prototypes. */