Ignore:
Timestamp:
Mar 15, 2017, 9:43:15 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:
27fed7f1, 738e304
Parents:
bf4ac09 (diff), 9b443c7f (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.
git-author:
Peter A. Buhr <pabuhr@…> (03/15/17 21:25:49)
git-committer:
Peter A. Buhr <pabuhr@…> (03/15/17 21:43:15)
Message:

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

File:
1 moved

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/thread.c

    rbf4ac09 rf2e40a9f  
    66// file "LICENCE" distributed with Cforall.
    77//
    8 // threads.c --
     8// thread.c --
    99//
    1010// Author           : Thierry Delisle
     
    1515//
    1616
    17 #include "threads"
     17#include "thread"
    1818
    1919#include "kernel_private.h"
     
    2828}
    2929
    30 extern processor * get_this_processor();
     30extern thread_local processor * this_processor;
    3131
    3232//-----------------------------------------------------------------------------
     
    4141// Thread ctors and dtors
    4242
    43 void ?{}(thread* this) {
     43void ?{}(thread_desc* this) {
    4444        (&this->c){};
    4545        this->c.name = "Anonymous Coroutine";
     
    4848}
    4949
    50 void ^?{}(thread* this) {
     50void ^?{}(thread_desc* this) {
    5151        ^(&this->c){};
    5252}
     
    7474forall( dtype T | is_thread(T) )
    7575void start( T* this ) {
    76         coroutine* thrd_c = get_coroutine(this);
    77         thread*  thrd_h = get_thread   (this);
     76        coroutine_desc* thrd_c = get_coroutine(this);
     77        thread_desc*  thrd_h = get_thread   (this);
    7878        thrd_c->last = this_coroutine();
    79         get_this_processor()->current_coroutine = thrd_c;
     79        this_processor->current_coroutine = thrd_c;
    8080
    8181        LIB_DEBUG_PRINTF("Thread start : %p (t %p, c %p)\n", this, thrd_c, thrd_h);
     
    9494
    9595void yield( void ) {
    96         ScheduleInternal( get_this_processor()->current_thread );
     96        ScheduleInternal( this_processor->current_thread );
    9797}
    9898
    99 void ThreadCtxSwitch(coroutine* src, coroutine* dst) {
     99void ThreadCtxSwitch(coroutine_desc* src, coroutine_desc* dst) {
    100100        // set state of current coroutine to inactive
    101101        src->state = Inactive;
     
    107107        // set new coroutine that the processor is executing
    108108        // and context switch to it
    109         get_this_processor()->current_coroutine = dst; 
     109        this_processor->current_coroutine = dst;
    110110        CtxSwitch( src->stack.context, dst->stack.context );
    111         get_this_processor()->current_coroutine = src; 
     111        this_processor->current_coroutine = src;
    112112
    113113        // set state of new coroutine to active
     
    116116}
    117117
    118 // C Helper to signal the termination of a thread
     118// C Helper to signal the termination of a thread_desc
    119119// Used in invoke.c
    120120extern "C" {
    121         void __thread_signal_termination( thread * this ) {
     121        void __thread_signal_termination( thread_desc * this ) {
    122122                this->c.state = Halted;
    123123                LIB_DEBUG_PRINTF("Thread end : %p\n", this);
Note: See TracChangeset for help on using the changeset viewer.