source: libcfa/src/concurrency/clib/cfathread.cfa @ 79e261b7

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 79e261b7 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
RevLine 
[bb662027]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
19thread CRunner {
20        void (*themain)( CRunner * );
21};
22
23static void ?{}( CRunner & this, void (*themain)( CRunner * ) ) {
24        this.themain = themain;
25}
26
27void main( CRunner & this ) {
28        this.themain( &this );
29}
30
31processor * procs = 0p;
32int proc_cnt = 1;
33
34extern "C" {
35        //--------------------
[038110a]36        // Basic thread management
[bb662027]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 ) {
[e235429]46                park();
[bb662027]47        }
48
49        void cfathread_unpark( CRunner * thrd ) {
[e235429]50                unpark( *thrd );
[bb662027]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 );
[45444c3]61                adelete( procs );
[bb662027]62
63                proc_cnt = ncnt - 1;
64                procs = anew(proc_cnt);
65        }
[45444c3]66}
Note: See TracBrowser for help on using the repository browser.