ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 9d6e1b8a was
45444c3,
checked in by m3zulfiq <m3zulfiq@…>, 4 years ago
|
Removed dimension parameter from adelete.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | // |
---|
2 | // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo |
---|
3 | // |
---|
4 | // The contents of this file are covered under the licence agreement in the |
---|
5 | // file "LICENCE" distributed with Cforall. |
---|
6 | // |
---|
7 | // clib/cfathread.cfa -- |
---|
8 | // |
---|
9 | // Author : Thierry Delisle |
---|
10 | // Created On : Tue Sep 22 15:31:20 2020 |
---|
11 | // Last Modified By : |
---|
12 | // Last Modified On : |
---|
13 | // Update Count : |
---|
14 | // |
---|
15 | |
---|
16 | #include "kernel.hfa" |
---|
17 | #include "thread.hfa" |
---|
18 | |
---|
19 | thread CRunner { |
---|
20 | void (*themain)( CRunner * ); |
---|
21 | }; |
---|
22 | |
---|
23 | static void ?{}( CRunner & this, void (*themain)( CRunner * ) ) { |
---|
24 | this.themain = themain; |
---|
25 | } |
---|
26 | |
---|
27 | void main( CRunner & this ) { |
---|
28 | this.themain( &this ); |
---|
29 | } |
---|
30 | |
---|
31 | processor * procs = 0p; |
---|
32 | int proc_cnt = 1; |
---|
33 | |
---|
34 | extern "C" { |
---|
35 | //-------------------- |
---|
36 | // Basic thread management |
---|
37 | CRunner * cfathread_create( void (*main)( CRunner * ) ) { |
---|
38 | return new( main ); |
---|
39 | } |
---|
40 | |
---|
41 | void cfathread_join( CRunner * thrd ) { |
---|
42 | delete( thrd ); |
---|
43 | } |
---|
44 | |
---|
45 | void cfathread_park( void ) { |
---|
46 | park(); |
---|
47 | } |
---|
48 | |
---|
49 | void cfathread_unpark( CRunner * thrd ) { |
---|
50 | unpark( *thrd ); |
---|
51 | } |
---|
52 | |
---|
53 | void cfathread_yield( void ) { |
---|
54 | yield(); |
---|
55 | } |
---|
56 | |
---|
57 | //-------------------- |
---|
58 | // Basic kernel features |
---|
59 | void cfathread_setproccnt( int ncnt ) { |
---|
60 | assert( ncnt >= 1 ); |
---|
61 | adelete( procs ); |
---|
62 | |
---|
63 | proc_cnt = ncnt - 1; |
---|
64 | procs = anew(proc_cnt); |
---|
65 | } |
---|
66 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.