ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since 24cde55 was
eafb094,
checked in by Thierry Delisle <tdelisle@…>, 8 years ago
|
Removed global spinlock
|
-
Property mode set to
100644
|
File size:
1.8 KB
|
Rev | Line | |
---|
[8118303] | 1 | // -*- Mode: CFA -*- |
---|
| 2 | // |
---|
| 3 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
| 4 | // |
---|
| 5 | // The contents of this file are covered under the licence agreement in the |
---|
| 6 | // file "LICENCE" distributed with Cforall. |
---|
| 7 | // |
---|
| 8 | // threads -- |
---|
| 9 | // |
---|
| 10 | // Author : Thierry Delisle |
---|
[75f3522] | 11 | // Created On : Tue Jan 17 12:27:26 2017 |
---|
[8118303] | 12 | // Last Modified By : Thierry Delisle |
---|
| 13 | // Last Modified On : -- |
---|
| 14 | // Update Count : 0 |
---|
| 15 | // |
---|
| 16 | |
---|
| 17 | #ifndef KERNEL_H |
---|
| 18 | #define KERNEL_H |
---|
| 19 | |
---|
[c84e80a] | 20 | #include <stdbool.h> |
---|
[8118303] | 21 | |
---|
[bd98b58] | 22 | #include "invoke.h" |
---|
| 23 | |
---|
[8def349] | 24 | extern "C" { |
---|
| 25 | #include <pthread.h> |
---|
| 26 | } |
---|
| 27 | |
---|
[db6f06a] | 28 | //----------------------------------------------------------------------------- |
---|
| 29 | // Locks |
---|
| 30 | void lock( spinlock * ); |
---|
| 31 | void unlock( spinlock * ); |
---|
| 32 | |
---|
| 33 | void wait( signal_once * ); |
---|
| 34 | void signal( signal_once * ); |
---|
| 35 | |
---|
[bd98b58] | 36 | //----------------------------------------------------------------------------- |
---|
| 37 | // Cluster |
---|
| 38 | struct cluster { |
---|
| 39 | simple_thread_list ready_queue; |
---|
[db6f06a] | 40 | spinlock lock; |
---|
[bd98b58] | 41 | }; |
---|
| 42 | |
---|
| 43 | void ?{}(cluster * this); |
---|
| 44 | void ^?{}(cluster * this); |
---|
| 45 | |
---|
| 46 | //----------------------------------------------------------------------------- |
---|
| 47 | // Processor |
---|
[db6f06a] | 48 | enum FinishOpCode { No_Action, Release, Schedule, Release_Schedule }; |
---|
| 49 | struct FinishAction { |
---|
| 50 | FinishOpCode action_code; |
---|
| 51 | thread * thrd; |
---|
| 52 | spinlock * lock; |
---|
[8fcbb4c] | 53 | }; |
---|
[db6f06a] | 54 | static inline void ?{}(FinishAction * this) { |
---|
| 55 | this->action_code = No_Action; |
---|
| 56 | this->thrd = NULL; |
---|
| 57 | this->lock = NULL; |
---|
| 58 | } |
---|
| 59 | static inline void ^?{}(FinishAction * this) {} |
---|
[8fcbb4c] | 60 | |
---|
[c84e80a] | 61 | struct processor { |
---|
[8fcbb4c] | 62 | struct processorCtx_t * runner; |
---|
[bd98b58] | 63 | cluster * cltr; |
---|
| 64 | coroutine * current_coroutine; |
---|
[e15df4c] | 65 | thread * current_thread; |
---|
[8def349] | 66 | pthread_t kernel_thread; |
---|
[db6f06a] | 67 | |
---|
| 68 | signal_once terminated; |
---|
| 69 | volatile bool is_terminated; |
---|
| 70 | |
---|
| 71 | struct FinishAction finish; |
---|
[c84e80a] | 72 | }; |
---|
| 73 | |
---|
[8def349] | 74 | void ?{}(processor * this); |
---|
[bd98b58] | 75 | void ?{}(processor * this, cluster * cltr); |
---|
[c84e80a] | 76 | void ^?{}(processor * this); |
---|
| 77 | |
---|
[8118303] | 78 | #endif //KERNEL_H |
---|
| 79 | |
---|
| 80 | // Local Variables: // |
---|
| 81 | // mode: c // |
---|
| 82 | // tab-width: 4 // |
---|
| 83 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.