Ignore:
Timestamp:
Mar 21, 2017, 2:29:25 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
9c31349
Parents:
e04b636
Message:

Threads now use monitor semantics to wait until completion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/thread

    re04b636 rcb0e6de  
    2222
    2323#include "coroutine"
     24#include "monitor"
    2425
    2526//-----------------------------------------------------------------------------
     
    2829// Anything that is resumed is a coroutine.
    2930trait is_thread(dtype T) {
    30       void ^?{}(T* this);
     31      void ^?{}(T* mutex this);
    3132      void main(T* this);
    3233      thread_desc* get_thread(T* this);
     
    4041}
    4142
    42 static inline coroutine_desc* get_coroutine(thread_desc* this) {
     43forall( dtype T | is_thread(T) )
     44static inline monitor_desc* get_monitor(T * this) {
     45        return &get_thread(this)->mon;
     46}
     47
     48static inline coroutine_desc* get_coroutine(thread_desc * this) {
    4349        return &this->cor;
     50}
     51
     52static inline monitor_desc* get_monitor(thread_desc * this) {
     53        return &this->mon;
    4454}
    4555
Note: See TracChangeset for help on using the changeset viewer.