Ignore:
Timestamp:
Jan 27, 2017, 3:27:34 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
c0aa336
Parents:
6acb935 (diff), 0a86a30 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg2:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/threads

    r6acb935 ra362f97  
    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_h* get_thread(T* this);
    32         /*void ?{}(T*);
    33         void ^?{}(T*);*/
     31      thread* get_thread(T* this);
    3432};
    3533
    36 forall(otype T | is_thread(T) )
     34#define DECL_THREAD(X) static inline thread* get_thread(X* this) { return &this->t; } void main(X* this);
     35
     36forall( dtype T | sized(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_h* this) {
     41static inline coroutine* get_coroutine(thread* this) {
    4242        return &this->c;
    4343}
    4444
     45thread * this_thread(void);
     46
    4547//-----------------------------------------------------------------------------
    4648// Ctors and dtors
    47 void ?{}(thread_h* this);
    48 void ^?{}(thread_h* this);
     49void ?{}(thread* this);
     50void ^?{}(thread* this);
    4951
    5052//-----------------------------------------------------------------------------
    5153// thread runner
    5254// Structure that actually start and stop threads
    53 forall(otype T | is_thread(T) )
    54 struct thread {
     55forall( dtype T | sized(T) | is_thread(T) )
     56struct scoped {
    5557        T handle;
    5658};
    5759
    58 forall(otype T | is_thread(T) )
    59 void ?{}( thread(T)* this );
     60forall( dtype T | sized(T) | is_thread(T) | { void ?{}(T*); } )
     61void ?{}( scoped(T)* this );
    6062
    61 forall(otype T, ttype P | is_thread(T) | { void ?{}(T*, P); } )
    62 void ?{}( thread(T)* this, P params );
     63forall( dtype T, ttype P | sized(T) | is_thread(T) | { void ?{}(T*, P); } )
     64void ?{}( scoped(T)* this, P params );
    6365
    64 forall(otype T | is_thread(T) )
    65 void ^?{}( thread(T)* this );
     66forall( dtype T | sized(T) | is_thread(T) | { void ^?{}(T*); } )
     67void ^?{}( scoped(T)* this );
    6668
    67 //-----------------------------------------------------------------------------
    68 // PRIVATE exposed because of inline
     69void yield();
    6970
    7071#endif //THREADS_H
Note: See TracChangeset for help on using the changeset viewer.