Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/threads

    re15df4c rc84e80a  
    2727// Anything that implements this trait can be resumed.
    2828// Anything that is resumed is a coroutine.
    29 trait is_thread(dtype T | sized(T)) {
     29trait is_thread(dtype T /*| sized(T)*/) {
    3030      void main(T* this);
    31       thread* get_thread(T* this);
     31      thread_h* get_thread(T* this);
     32        /*void ?{}(T*);
     33        void ^?{}(T*);*/
    3234};
    3335
    34 #define DECL_THREAD(X) static inline thread* get_thread(X* this) { return &this->t; } void main(X* this);
    35 
    36 forall( dtype T | sized(T) | is_thread(T) )
     36forall(otype T | is_thread(T) )
    3737static inline coroutine* get_coroutine(T* this) {
    3838        return &get_thread(this)->c;
    3939}
    4040
    41 static inline coroutine* get_coroutine(thread* this) {
     41static inline coroutine* get_coroutine(thread_h* this) {
    4242        return &this->c;
    4343}
    4444
    45 thread * this_thread(void);
    46 
    4745//-----------------------------------------------------------------------------
    4846// Ctors and dtors
    49 void ?{}(thread* this);
    50 void ^?{}(thread* this);
     47void ?{}(thread_h* this);
     48void ^?{}(thread_h* this);
    5149
    5250//-----------------------------------------------------------------------------
    5351// thread runner
    5452// Structure that actually start and stop threads
    55 forall( dtype T | sized(T) | is_thread(T) )
    56 struct scoped {
     53forall(otype T | is_thread(T) )
     54struct thread {
    5755        T handle;
    5856};
    5957
    60 forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } )
    61 void ?{}( scoped(T)* this );
     58forall(otype T | is_thread(T) )
     59void ?{}( thread(T)* this );
    6260
    63 forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } )
    64 void ?{}( scoped(T)* this, P params );
     61forall(otype T, ttype P | is_thread(T) | { void ?{}(T*, P); } )
     62void ?{}( thread(T)* this, P params );
    6563
    66 forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); } )
    67 void ^?{}( scoped(T)* this );
     64forall(otype T | is_thread(T) )
     65void ^?{}( thread(T)* this );
    6866
    69 void yield();
     67//-----------------------------------------------------------------------------
     68// PRIVATE exposed because of inline
    7069
    7170#endif //THREADS_H
Note: See TracChangeset for help on using the changeset viewer.