source: src/examples/multicore.c @ 8d4f7fe

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 8d4f7fe was 8d4f7fe, checked in by Thierry Delisle <tdelisle@…>, 8 years ago

added multicore example which just spins

  • Property mode set to 100644
File size: 437 bytes
Line 
1#include <kernel>
2#include <threads>
3
4struct MyThread { thread t; };
5
6DECL_THREAD(MyThread);
7
8void ?{}( MyThread * this ) {}
9
10void main( MyThread* this ) {
11        for(int i = 0; i < 10000000; i++) {
12                yield();
13        }
14}
15
16int main(int argc, char* argv[]) {
17        sout | "User main begin" | endl;
18        {
19                processor p;
20                {
21                        scoped(MyThread) f1;
22                        scoped(MyThread) f2;
23                        scoped(MyThread) f3;
24                        scoped(MyThread) f4;
25                }
26        }
27        sout | "User main end" | endl;
28}
Note: See TracBrowser for help on using the repository browser.