- File:
-
- 1 edited
-
libcfa/src/concurrency/monitor.cfa (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/monitor.cfa
rc18bf9e r708ae38 44 44 static inline void restore( monitor$ * ctx [], __lock_size_t count, __spinlock_t * locks [], unsigned int /*in */ recursions [], __waitfor_mask_t /*in */ masks [] ); 45 45 46 static inline void ?{}(__condition_node_t & this, thread$ * waiting_thread, __lock_size_t count, uintptr_t user_info );47 static inline void ?{}(__condition_criterion_t & this );48 static inline void ?{}(__condition_criterion_t & this, monitor$ * target, __condition_node_t * owner );49 50 46 static inline void init ( __lock_size_t count, monitor$ * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ); 51 47 static inline void init_push( __lock_size_t count, monitor$ * monitors [], __condition_node_t & waiter, __condition_criterion_t criteria [] ); … … 247 243 248 244 // Leave single monitor 249 staticvoid __leave( monitor$ * this ) {245 void __leave( monitor$ * this ) { 250 246 // Lock the monitor spinlock 251 247 lock( this->lock __cfaabi_dbg_ctx2 ); … … 282 278 283 279 // Leave single monitor for the last time 284 staticvoid __dtor_leave( monitor$ * this, bool join ) {280 void __dtor_leave( monitor$ * this, bool join ) { 285 281 __cfaabi_dbg_debug_do( 286 282 if( active_thread() != this->owner ) { … … 348 344 // Ctor for monitor guard 349 345 // Sorts monitors before entering 350 void ?{}( monitor_guard_t & this, monitor$ * m [], __lock_size_t count, fptr_t func ) libcfa_public{346 void ?{}( monitor_guard_t & this, monitor$ * m [], __lock_size_t count, fptr_t func ) { 351 347 thread$ * thrd = active_thread(); 352 348 … … 373 369 } 374 370 375 void ?{}( monitor_guard_t & this, monitor$ * m [], __lock_size_t count ) libcfa_public{371 void ?{}( monitor_guard_t & this, monitor$ * m [], __lock_size_t count ) { 376 372 this{ m, count, 0p }; 377 373 } … … 379 375 380 376 // Dtor for monitor guard 381 void ^?{}( monitor_guard_t & this ) libcfa_public{377 void ^?{}( monitor_guard_t & this ) { 382 378 // __cfaabi_dbg_print_safe( "MGUARD : leaving %d\n", this.count); 383 379 … … 393 389 // Ctor for monitor guard 394 390 // Sorts monitors before entering 395 void ?{}( monitor_dtor_guard_t & this, monitor$ * m [], fptr_t func, bool join ) libcfa_public{391 void ?{}( monitor_dtor_guard_t & this, monitor$ * m [], fptr_t func, bool join ) { 396 392 // optimization 397 393 thread$ * thrd = active_thread(); … … 413 409 414 410 // Dtor for monitor guard 415 void ^?{}( monitor_dtor_guard_t & this ) libcfa_public{411 void ^?{}( monitor_dtor_guard_t & this ) { 416 412 // Leave the monitors in order 417 413 __dtor_leave( this.m, this.join ); … … 423 419 //----------------------------------------------------------------------------- 424 420 // Internal scheduling types 425 staticvoid ?{}(__condition_node_t & this, thread$ * waiting_thread, __lock_size_t count, uintptr_t user_info ) {421 void ?{}(__condition_node_t & this, thread$ * waiting_thread, __lock_size_t count, uintptr_t user_info ) { 426 422 this.waiting_thread = waiting_thread; 427 423 this.count = count; … … 430 426 } 431 427 432 staticvoid ?{}(__condition_criterion_t & this ) with( this ) {428 void ?{}(__condition_criterion_t & this ) with( this ) { 433 429 ready = false; 434 430 target = 0p; … … 437 433 } 438 434 439 staticvoid ?{}(__condition_criterion_t & this, monitor$ * target, __condition_node_t & owner ) {435 void ?{}(__condition_criterion_t & this, monitor$ * target, __condition_node_t & owner ) { 440 436 this.ready = false; 441 437 this.target = target; … … 446 442 //----------------------------------------------------------------------------- 447 443 // Internal scheduling 448 void wait( condition & this, uintptr_t user_info = 0 ) libcfa_public{444 void wait( condition & this, uintptr_t user_info = 0 ) { 449 445 brand_condition( this ); 450 446 … … 500 496 } 501 497 502 bool signal( condition & this ) libcfa_public{498 bool signal( condition & this ) { 503 499 if( is_empty( this ) ) { return false; } 504 500 … … 542 538 } 543 539 544 bool signal_block( condition & this ) libcfa_public{540 bool signal_block( condition & this ) { 545 541 if( !this.blocked.head ) { return false; } 546 542 … … 590 586 591 587 // Access the user_info of the thread waiting at the front of the queue 592 uintptr_t front( condition & this ) libcfa_public{588 uintptr_t front( condition & this ) { 593 589 verifyf( !is_empty(this), 594 590 "Attempt to access user data on an empty condition.\n" … … 612 608 // setup mask 613 609 // block 614 void __waitfor_internal( const __waitfor_mask_t & mask, int duration ) libcfa_public{610 void __waitfor_internal( const __waitfor_mask_t & mask, int duration ) { 615 611 // This statment doesn't have a contiguous list of monitors... 616 612 // Create one! … … 998 994 // Can't be accepted since a mutex stmt is effectively an anonymous routine 999 995 // Thus we do not need a monitor group 1000 void lock( monitor$ * this ) libcfa_public{996 void lock( monitor$ * this ) { 1001 997 thread$ * thrd = active_thread(); 1002 998 … … 1050 1046 // Leave routine for mutex stmt 1051 1047 // Is just a wrapper around __leave for the is_lock trait to see 1052 void unlock( monitor$ * this ) libcfa_public{ __leave( this ); }1048 void unlock( monitor$ * this ) { __leave( this ); } 1053 1049 1054 1050 // Local Variables: //
Note:
See TracChangeset
for help on using the changeset viewer.