diff options
Diffstat (limited to 'pintos-progos/threads/thread.h')
| -rw-r--r-- | pintos-progos/threads/thread.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/pintos-progos/threads/thread.h b/pintos-progos/threads/thread.h index eebf42c..9cc5ef7 100644 --- a/pintos-progos/threads/thread.h +++ b/pintos-progos/threads/thread.h | |||
| @@ -76,11 +76,13 @@ typedef int tid_t; | |||
| 76 | set to THREAD_MAGIC. Stack overflow will normally change this | 76 | set to THREAD_MAGIC. Stack overflow will normally change this |
| 77 | value, triggering the assertion. */ | 77 | value, triggering the assertion. */ |
| 78 | /* The `elem' member has a dual purpose. It can be an element in | 78 | /* The `elem' member has a dual purpose. It can be an element in |
| 79 | the run queue (thread.c), or it can be an element in a | 79 | the run queue (thread.c), it can be an element in a semaphore |
| 80 | semaphore wait list (synch.c). It can be used these two ways | 80 | wait list (synch.c), or it can be an element in the alarm sleep |
| 81 | only because they are mutually exclusive: only a thread in the | 81 | list (timer.c). It can be used these two ways only because they |
| 82 | ready state is on the run queue, whereas only a thread in the | 82 | are mutually exclusive: only a thread in the ready state is on |
| 83 | blocked state is on a semaphore wait list. */ | 83 | the run queue, only a thread in the blocked state is on a semaphore |
| 84 | wait list, whereas only a thread waiting for an alarm event is on | ||
| 85 | the alarm sleep list. */ | ||
| 84 | struct thread | 86 | struct thread |
| 85 | { | 87 | { |
| 86 | /* Owned by thread.c. */ | 88 | /* Owned by thread.c. */ |
| @@ -91,7 +93,7 @@ struct thread | |||
| 91 | int priority; /* Priority. */ | 93 | int priority; /* Priority. */ |
| 92 | struct list_elem allelem; /* List element for all threads list. */ | 94 | struct list_elem allelem; /* List element for all threads list. */ |
| 93 | 95 | ||
| 94 | /* Shared between thread.c and synch.c. */ | 96 | /* Shared between thread.c, synch.c and timer.c. */ |
| 95 | struct list_elem elem; /* List element. */ | 97 | struct list_elem elem; /* List element. */ |
| 96 | 98 | ||
| 97 | #ifdef USERPROG | 99 | #ifdef USERPROG |
| @@ -103,6 +105,8 @@ struct thread | |||
| 103 | 105 | ||
| 104 | /* Owned by thread.c. */ | 106 | /* Owned by thread.c. */ |
| 105 | unsigned magic; /* Detects stack overflow. */ | 107 | unsigned magic; /* Detects stack overflow. */ |
| 108 | |||
| 109 | int64_t alarm_tick; /* absolute tick when to trigger an alarm event */ | ||
| 106 | }; | 110 | }; |
| 107 | 111 | ||
| 108 | /* If false (default), use round-robin scheduler. | 112 | /* If false (default), use round-robin scheduler. |
