Subversion Repositories HelenOS

Rev

Rev 2096 | Rev 2106 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2096 Rev 2103
Line 35... Line 35...
35
#ifndef KERN_THREAD_H_
35
#ifndef KERN_THREAD_H_
36
#define KERN_THREAD_H_
36
#define KERN_THREAD_H_
37
 
37
 
38
#include <synch/waitq.h>
38
#include <synch/waitq.h>
39
#include <proc/task.h>
39
#include <proc/task.h>
-
 
40
#include <time/timeout.h>
40
#include <cpu.h>
41
#include <cpu.h>
41
#include <synch/rwlock.h>
42
#include <synch/rwlock.h>
42
#include <adt/btree.h>
43
#include <adt/btree.h>
43
#include <mm/slab.h>
44
#include <mm/slab.h>
44
#include <arch/cpu.h>
45
#include <arch/cpu.h>
Line 53... Line 54...
53
/* Thread flags */
54
/* Thread flags */
54
#define THREAD_FLAG_WIRED   (1 << 0)    /**< Thread cannot be migrated to another CPU. */
55
#define THREAD_FLAG_WIRED   (1 << 0)    /**< Thread cannot be migrated to another CPU. */
55
#define THREAD_FLAG_STOLEN  (1 << 1)    /**< Thread was migrated to another CPU and has not run yet. */
56
#define THREAD_FLAG_STOLEN  (1 << 1)    /**< Thread was migrated to another CPU and has not run yet. */
56
#define THREAD_FLAG_USPACE  (1 << 2)    /**< Thread executes in userspace. */
57
#define THREAD_FLAG_USPACE  (1 << 2)    /**< Thread executes in userspace. */
57
 
58
 
-
 
59
/** Thread states. */
-
 
60
typedef enum {
-
 
61
    Invalid,    /**< It is an error, if thread is found in this state. */
-
 
62
    Running,    /**< State of a thread that is currently executing on some CPU. */
-
 
63
    Sleeping,   /**< Thread in this state is waiting for an event. */
-
 
64
    Ready,      /**< State of threads in a run queue. */
-
 
65
    Entering,   /**< Threads are in this state before they are first readied. */
-
 
66
    Exiting,    /**< After a thread calls thread_exit(), it is put into Exiting state. */
-
 
67
    Undead      /**< Threads that were not detached but exited are in the Undead state. */
-
 
68
} state_t;
-
 
69
 
-
 
70
/** Join types. */
-
 
71
typedef enum {
-
 
72
    None,
-
 
73
    TaskClnp,   /**< The thread will be joined by ktaskclnp thread. */
-
 
74
    TaskGC      /**< The thread will be joined by ktaskgc thread. */
-
 
75
} thread_join_type_t;
-
 
76
 
58
/** Thread structure. There is one per thread. */
77
/** Thread structure. There is one per thread. */
59
typedef struct thread {
78
typedef struct thread {
60
    link_t rq_link;             /**< Run queue link. */
79
    link_t rq_link;             /**< Run queue link. */
61
    link_t wq_link;             /**< Wait queue link. */
80
    link_t wq_link;             /**< Wait queue link. */
62
    link_t th_link;             /**< Links to threads within containing task. */
81
    link_t th_link;             /**< Links to threads within containing task. */