Ignore:
Timestamp:
Jan 19, 2017, 2:56:51 PM (9 years ago)
Author:
Thierry Delisle <tdelisle@…>
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:
8f49a54
Parents:
765aa76 (diff), c2416d5 (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 plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    r765aa76 r4a3386b4  
    1414
    1515extern void __suspend_no_inline__F___1(void);
     16extern void __scheduler_remove__F_P9sthread_h__1(struct thread_h*);
    1617
    1718void CtxInvokeCoroutine(
     
    2021      void *this
    2122) {
    22       LIB_DEBUG_PRINTF("Invoke : Received %p (main %p, get_c %p)\n", this, main, get_coroutine);
     23      // LIB_DEBUG_PRINTF("Invoke Coroutine : Received %p (main %p, get_c %p)\n", this, main, get_coroutine);
    2324
    2425      struct coroutine* cor = get_coroutine( this );
     
    3132
    3233      main( this );
     34
     35      //Final suspend, should never return
     36      __suspend_no_inline__F___1();
     37      assertf(false, "Resumed dead coroutine");
     38}
     39
     40void CtxInvokeThread(
     41      void (*main)(void *),
     42      struct thread_h *(*get_thread)(void *),
     43      void *this
     44) {
     45      // LIB_DEBUG_PRINTF("Invoke Thread : Received %p (main %p, get_t %p)\n", this, main, get_thread);
     46
     47      __suspend_no_inline__F___1();
     48
     49      struct thread_h* thrd = get_thread( this );
     50      struct coroutine* cor = &thrd->c;
     51      cor->state = Active;
     52
     53      // LIB_DEBUG_PRINTF("Invoke Thread : invoking main %p (args %p)\n", main, this);
     54      main( this );
     55
     56      __scheduler_remove__F_P9sthread_h__1(thrd);
     57
     58      //Final suspend, should never return
     59      __suspend_no_inline__F___1();
     60      assertf(false, "Resumed dead thread");
    3361}
    3462
     
    4068      void (*invoke)(void *)
    4169) {
    42       LIB_DEBUG_PRINTF("StartCoroutine : Passing in %p (main %p, get_c %p) to %p\n", this, main, get_coroutine, invoke);
     70      // LIB_DEBUG_PRINTF("StartCoroutine : Passing in %p (main %p) to invoke (%p) from start (%p)\n", this, main, invoke, CtxStart);
    4371
    4472      struct coStack_t* stack = &get_coroutine( this )->stack;
Note: See TracChangeset for help on using the changeset viewer.