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 bd98b58 was
bd98b58,
checked in by Thierry Delisle <tdelisle@…>, 8 years ago
|
Kernel now uses intrusive lists and blocking locks for ready queue management.
Update the plan for concurrency.
|
-
Property mode set to
100644
|
File size:
910 bytes
|
Line | |
---|
1 | #include <fstream> |
---|
2 | #include <stdlib> |
---|
3 | #include <threads> |
---|
4 | |
---|
5 | // Start coroutine routines |
---|
6 | struct MyThread { |
---|
7 | thread_h t; |
---|
8 | unsigned id; |
---|
9 | unsigned count; |
---|
10 | }; |
---|
11 | |
---|
12 | // DECL_THREAD(MyThread) |
---|
13 | |
---|
14 | void ?{}( MyThread * this, unsigned id, unsigned count ) { |
---|
15 | this->id = id; |
---|
16 | this->count = count; |
---|
17 | } |
---|
18 | |
---|
19 | // void main(MyThread* this) { |
---|
20 | // sout | "Thread" | this->id | " : Suspending" | this->count | "times" | endl; |
---|
21 | // yield(); |
---|
22 | |
---|
23 | // for(int i = 0; i < this->count; i++) { |
---|
24 | // sout | "Thread" | this->id | " : Suspend No." | i + 1 | endl; |
---|
25 | // yield(); |
---|
26 | // } |
---|
27 | // } |
---|
28 | |
---|
29 | int main(int argc, char* argv[]) { |
---|
30 | |
---|
31 | // unsigned itterations = 10u; |
---|
32 | // if(argc == 2) { |
---|
33 | // int val = ato(argv[1]); |
---|
34 | // assert(val >= 0); |
---|
35 | // itterations = val; |
---|
36 | // } |
---|
37 | |
---|
38 | sout | "User main begin" | endl; |
---|
39 | |
---|
40 | // { |
---|
41 | // thread(MyThread) thread1 = { 1u, itterations }; |
---|
42 | // thread(MyThread) thread2 = { 2u, itterations }; |
---|
43 | // } |
---|
44 | |
---|
45 | sout | "User main end" | endl; |
---|
46 | |
---|
47 | return 0; |
---|
48 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.