Ignore:
Timestamp:
Apr 14, 2020, 11:53:25 AM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
34d0a28
Parents:
7df014f
Message:

Implemented basic non-blocking io

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/alarm.cfa

    r7df014f r2d8f7b0  
    176176}
    177177
     178//=============================================================================================
     179// Utilities
     180//=============================================================================================
     181
     182void sleep( Duration duration ) {
     183        alarm_node_t node = { active_thread(), __kernel_get_time() + duration, 0`s };
     184
     185        register_self( &node );
     186        park( __cfaabi_dbg_ctx );
     187
     188        /* paranoid */ verify( !node.set );
     189        /* paranoid */ verify( node.next == 0p );
     190}
     191
    178192// Local Variables: //
    179193// mode: c //
Note: See TracChangeset for help on using the changeset viewer.