Subversion Repositories HelenOS

Rev

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

Rev 2451 Rev 2502
Line 39... Line 39...
39
#include <proc/task.h>
39
#include <proc/task.h>
40
#include <time/timeout.h>
40
#include <time/timeout.h>
41
#include <cpu.h>
41
#include <cpu.h>
42
#include <synch/rwlock.h>
42
#include <synch/rwlock.h>
43
#include <synch/spinlock.h>
43
#include <synch/spinlock.h>
44
#include <adt/btree.h>
44
#include <adt/avl.h>
45
#include <mm/slab.h>
45
#include <mm/slab.h>
46
#include <arch/cpu.h>
46
#include <arch/cpu.h>
47
#include <mm/tlb.h>
47
#include <mm/tlb.h>
48
#include <proc/uarg.h>
48
#include <proc/uarg.h>
49
 
49
 
Line 88... Line 88...
88
/** Thread structure. There is one per thread. */
88
/** Thread structure. There is one per thread. */
89
typedef struct thread {
89
typedef struct thread {
90
    link_t rq_link;     /**< Run queue link. */
90
    link_t rq_link;     /**< Run queue link. */
91
    link_t wq_link;     /**< Wait queue link. */
91
    link_t wq_link;     /**< Wait queue link. */
92
    link_t th_link;     /**< Links to threads within containing task. */
92
    link_t th_link;     /**< Links to threads within containing task. */
-
 
93
 
-
 
94
    /** Threads linkage to the threads_tree. */
-
 
95
    avltree_node_t threads_tree_node;
93
   
96
   
94
    /** Lock protecting thread structure.
97
    /** Lock protecting thread structure.
95
     *
98
     *
96
     * Protects the whole thread structure except list links above.
99
     * Protects the whole thread structure except list links above.
97
     */
100
     */
Line 202... Line 205...
202
    uint8_t *kstack;
205
    uint8_t *kstack;
203
} thread_t;
206
} thread_t;
204
 
207
 
205
/** Thread list lock.
208
/** Thread list lock.
206
 *
209
 *
207
 * This lock protects all link_t structures chained in threads_head.
210
 * This lock protects the threads_tree.
208
 * Must be acquired before T.lock for each T of type thread_t.
211
 * Must be acquired before T.lock for each T of type thread_t.
209
 *
212
 *
210
 */
213
 */
211
SPINLOCK_EXTERN(threads_lock);
214
SPINLOCK_EXTERN(threads_lock);
212
 
215
 
213
/** B+tree containing all threads. */
216
/** AVL tree containing all threads. */
214
extern btree_t threads_btree;
217
extern avltree_t threads_tree;
215
 
218
 
216
extern void thread_init(void);
219
extern void thread_init(void);
217
extern thread_t *thread_create(void (* func)(void *), void *arg, task_t *task,
220
extern thread_t *thread_create(void (* func)(void *), void *arg, task_t *task,
218
    int flags, char *name, bool uncounted);
221
    int flags, char *name, bool uncounted);
219
extern void thread_attach(thread_t *t, task_t *task);
222
extern void thread_attach(thread_t *t, task_t *task);