Changeset a843067 for src/libcfa
- Timestamp:
- Sep 21, 2017, 4:39:49 PM (7 years ago)
- 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:
- dbe7756
- Parents:
- 6ff4507
- Location:
- src/libcfa/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/coroutine.c
r6ff4507 ra843067 123 123 if(pageSize == 0ul) pageSize = sysconf( _SC_PAGESIZE ); 124 124 125 LIB_DEBUG_PRINT_SAFE("FRED");126 127 125 size_t cxtSize = libCeiling( sizeof(machine_context_t), 8 ); // minimum alignment 128 126 -
src/libcfa/concurrency/monitor.c
r6ff4507 ra843067 84 84 extern "C" { 85 85 // Enter single monitor 86 static void __enter_monitor_desc( const __monitor_group_t & group ) { 87 monitor_desc * this = group.list[0]; 88 86 static void __enter_monitor_desc( monitor_desc * this, const __monitor_group_t & group ) { 89 87 // Lock the monitor spinlock, lock_yield to reduce contention 90 88 lock_yield( &this->lock DEBUG_CTX2 ); … … 137 135 lock_yield( &this->lock DEBUG_CTX2 ); 138 136 139 verifyf( this_thread == this->owner, "Expected owner to be %p, got %p (r: %i)", this_thread, this->owner, this->recursion ); 137 LIB_DEBUG_PRINT_SAFE("Kernel : %10p Leaving mon %p (%p)\n", this_thread, this, this->owner); 138 139 verifyf( this_thread == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", this_thread, this->owner, this->recursion, this ); 140 140 141 141 // Leaving a recursion level, decrement the counter … … 172 172 thrd->self_cor.state = Halted; 173 173 174 verifyf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i )", thrd, this->owner, this->recursion);174 verifyf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i, m: %p)", thrd, this->owner, this->recursion, this ); 175 175 176 176 // Leaving a recursion level, decrement the counter … … 197 197 static inline void enter( __monitor_group_t monitors ) { 198 198 for(int i = 0; i < monitors.size; i++) { 199 __enter_monitor_desc( monitors );199 __enter_monitor_desc( monitors.list[i], monitors ); 200 200 } 201 201 } … … 229 229 this_thread->monitors.func = func; 230 230 231 LIB_DEBUG_PRINT_SAFE("MGUARD : enter %d\n", count); 232 231 233 // Enter the monitors in order 232 234 __monitor_group_t group = {this.m, this.count, func}; 233 235 enter( group ); 236 237 LIB_DEBUG_PRINT_SAFE("MGUARD : entered\n"); 234 238 } 235 239 … … 237 241 // Dtor for monitor guard 238 242 void ^?{}( monitor_guard_t & this ) { 243 LIB_DEBUG_PRINT_SAFE("MGUARD : leaving %d\n", this.count); 244 239 245 // Leave the monitors in order 240 246 leave( this.m, this.count ); 247 248 LIB_DEBUG_PRINT_SAFE("MGUARD : left\n"); 241 249 242 250 // Restore thread context … … 299 307 } 300 308 309 // Save monitor states 310 monitor_save; 311 301 312 // Remove any duplicate threads 302 313 for( int i = 0; i < count; i++) { … … 305 316 } 306 317 307 blockAndWake( threads, thread_count ); 318 // Everything is ready to go to sleep 319 BlockInternal( locks, count, threads, thread_count ); 320 321 // We are back, restore the owners and recursions 322 monitor_restore; 308 323 } 309 324 … … 458 473 459 474 static inline void set_owner( monitor_desc * this, thread_desc * owner ) { 475 LIB_DEBUG_PRINT_SAFE("Kernal : Setting owner of %p to %p ( was %p)\n", this, owner, this->owner ); 476 460 477 //Pass the monitor appropriately 461 478 this->owner = owner; … … 502 519 503 520 // Check if there are any acceptable functions 504 if( !it ) return -1;521 if( !it ) return false; 505 522 506 523 // If this isn't the first monitor to test this, there is no reason to repeat the test.
Note: See TracChangeset
for help on using the changeset viewer.