Rev 1392 | Rev 1427 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1392 | Rev 1407 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | #include <thread.h> |
33 | #include <thread.h> |
34 | #include <stdio.h> |
34 | #include <stdio.h> |
35 | #include <kernel/arch/faddr.h> |
35 | #include <kernel/arch/faddr.h> |
36 | #include <futex.h> |
36 | #include <futex.h> |
37 | #include <assert.h> |
37 | #include <assert.h> |
- | 38 | #include <async.h> |
|
38 | 39 | ||
39 | #ifndef PSTHREAD_INITIAL_STACK_PAGES_NO |
40 | #ifndef PSTHREAD_INITIAL_STACK_PAGES_NO |
40 | #define PSTHREAD_INITIAL_STACK_PAGES_NO 1 |
41 | #define PSTHREAD_INITIAL_STACK_PAGES_NO 1 |
41 | #endif |
42 | #endif |
42 | 43 | ||
Line 132... | Line 133... | ||
132 | goto ret_0; |
133 | goto ret_0; |
133 | 134 | ||
134 | if (ctype == PS_FROM_MANAGER && list_empty(&ready_list)) { |
135 | if (ctype == PS_FROM_MANAGER && list_empty(&ready_list)) { |
135 | goto ret_0; |
136 | goto ret_0; |
136 | } |
137 | } |
- | 138 | /* If we are going to manager and none exists, create it */ |
|
137 | assert(!(ctype == PS_TO_MANAGER && list_empty(&manager_list))); |
139 | if (ctype == PS_TO_MANAGER && list_empty(&manager_list)) |
- | 140 | async_create_manager(); |
|
138 | 141 | ||
139 | pt = __tcb_get()->pst_data; |
142 | pt = __tcb_get()->pst_data; |
140 | if (!context_save(&pt->ctx)) |
143 | if (!context_save(&pt->ctx)) |
141 | return 1; // futex_up already done here |
144 | return 1; // futex_up already done here |
142 | 145 | ||
Line 248... | Line 251... | ||
248 | /** Remove one manager from manager list */ |
251 | /** Remove one manager from manager list */ |
249 | void psthread_remove_manager() |
252 | void psthread_remove_manager() |
250 | { |
253 | { |
251 | futex_down(&psthread_futex); |
254 | futex_down(&psthread_futex); |
252 | if (list_empty(&manager_list)) { |
255 | if (list_empty(&manager_list)) { |
253 | printf("No manager found!.\n"); |
- | |
254 | futex_up(&psthread_futex); |
256 | futex_up(&psthread_futex); |
255 | return; |
257 | return; |
256 | } |
258 | } |
257 | list_remove(manager_list.next); |
259 | list_remove(manager_list.next); |
258 | futex_up(&psthread_futex); |
260 | futex_up(&psthread_futex); |