- File:
-
- 1 edited
-
libcfa/src/concurrency/kernel/fwd.hfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel/fwd.hfa
ra76efc8 r454f478 108 108 109 109 extern void disable_interrupts(); 110 extern void enable_interrupts( bool poll = false ); 110 extern void enable_interrupts_noPoll(); 111 extern void enable_interrupts( __cfaabi_dbg_ctx_param ); 111 112 112 113 extern "Cforall" { … … 219 220 // Mark as fulfilled, wake thread if needed 220 221 // return true if a thread was unparked 221 $thread * post(oneshot & this, bool do_unpark = true) {222 bool post(oneshot & this) { 222 223 struct $thread * got = __atomic_exchange_n( &this.ptr, 1p, __ATOMIC_SEQ_CST); 223 if( got == 0p ) return 0p;224 if(do_unpark)unpark( got );225 return got;224 if( got == 0p ) return false; 225 unpark( got ); 226 return true; 226 227 } 227 228 } … … 335 336 // from the server side, mark the future as fulfilled 336 337 // delete it if needed 337 $thread * fulfil( future_t & this, bool do_unpark = true) {338 bool fulfil( future_t & this ) { 338 339 for() { 339 340 struct oneshot * expected = this.ptr; … … 343 344 #pragma GCC diagnostic ignored "-Wfree-nonheap-object" 344 345 #endif 345 if( expected == 3p ) { free( &this ); return 0p; }346 if( expected == 3p ) { free( &this ); return false; } 346 347 #if defined(__GNUC__) && __GNUC__ >= 7 347 348 #pragma GCC diagnostic pop … … 355 356 struct oneshot * want = expected == 0p ? 1p : 2p; 356 357 if(__atomic_compare_exchange_n(&this.ptr, &expected, want, false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) { 357 if( expected == 0p ) { /* paranoid */ verify( this.ptr == 1p); return 0p; }358 $thread * ret = post( *expected, do_unpark);358 if( expected == 0p ) { /* paranoid */ verify( this.ptr == 1p); return false; } 359 bool ret = post( *expected ); 359 360 __atomic_store_n( &this.ptr, 1p, __ATOMIC_SEQ_CST); 360 361 return ret; … … 402 403 __VA_ARGS__ \ 403 404 } \ 404 if( !(in_kernel) ) enable_interrupts( ); \405 if( !(in_kernel) ) enable_interrupts( __cfaabi_dbg_ctx ); \ 405 406 } 406 407 #else
Note:
See TracChangeset
for help on using the changeset viewer.