source:
src/libcfa/concurrency/kernel
@
348006f
Last change on this file since 348006f was 348006f, checked in by , 8 years ago | |
---|---|
|
|
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 | // | |
[75a17f1] | 8 | // kernel -- |
[8118303] | 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; | |
[348006f] | 51 | thread_desc * thrd; |
[db6f06a] | 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; |
[c3acb841] | 64 | coroutine_desc * current_coroutine; |
[348006f] | 65 | thread_desc * 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.