Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/thread

    r83a071f9 r6b0b624  
    1 //                              -*- Mode: CFA -*-
    21//
    32// Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
     
    109// Author           : Thierry Delisle
    1110// Created On       : Tue Jan 17 12:27:26 2017
    12 // Last Modified By : Thierry Delisle
    13 // Last Modified On : --
    14 // Update Count     : 0
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat Jul 22 09:59:40 2017
     13// Update Count     : 3
    1514//
    1615
    17 #ifndef THREADS_H
    18 #define THREADS_H
     16#pragma once
    1917
    20 #include "assert"
     18#include <assert.h>
    2119#include "invoke.h"
    2220
     
    2927// Anything that is resumed is a coroutine.
    3028trait is_thread(dtype T) {
    31       void ^?{}(T& mutex this);
    32       void main(T& this);
    33       thread_desc* get_thread(T& this);
     29      void ^?{}(T* mutex this);
     30      void main(T* this);
     31      thread_desc* get_thread(T* this);
    3432};
    3533
    36 #define DECL_THREAD(X) thread_desc* get_thread(X& this) { return &this.__thrd; } void main(X& this)
     34#define DECL_THREAD(X) thread_desc* get_thread(X* this) { return &this->__thrd; } void main(X* this)
    3735
    3836forall( dtype T | is_thread(T) )
    39 static inline coroutine_desc* get_coroutine(T & this) {
     37static inline coroutine_desc* get_coroutine(T* this) {
    4038        return &get_thread(this)->cor;
    4139}
    4240
    4341forall( dtype T | is_thread(T) )
    44 static inline monitor_desc* get_monitor(T & this) {
     42static inline monitor_desc* get_monitor(T * this) {
    4543        return &get_thread(this)->mon;
    4644}
     
    5452}
    5553
    56 extern volatile thread_local thread_desc * this_thread;
     54extern thread_local thread_desc * volatile this_thread;
    5755
    5856forall( dtype T | is_thread(T) )
    59 void __thrd_start( T & this );
     57void __thrd_start( T* this );
    6058
    6159//-----------------------------------------------------------------------------
    6260// Ctors and dtors
    63 void ?{}(thread_desc& this);
    64 void ^?{}(thread_desc& this);
     61void ?{}(thread_desc* this);
     62void ^?{}(thread_desc* this);
    6563
    6664//-----------------------------------------------------------------------------
     
    7270};
    7371
    74 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T&); } )
    75 void ?{}( scoped(T)& this );
     72forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } )
     73void ?{}( scoped(T)* this );
    7674
    77 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T&, P); } )
    78 void ?{}( scoped(T)& this, P params );
     75forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } )
     76void ?{}( scoped(T)* this, P params );
    7977
    8078forall( dtype T | sized(T) | is_thread(T) )
    81 void ^?{}( scoped(T)& this );
     79void ^?{}( scoped(T)* this );
    8280
    8381void yield();
    8482void yield( unsigned times );
    85 
    86 #endif //THREADS_H
    8783
    8884// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.