- Timestamp:
- Apr 19, 2017, 2:39:01 PM (8 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:
- 8731d8c
- Parents:
- 154fdc8
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/monitor.c
r154fdc8 rcd348e7 33 33 thread_desc * thrd = this_thread(); 34 34 35 //Update the stack owner 36 this->stack_owner = leader; 35 // //Update the stack owner 36 // this->stack_owner = leader; 37 38 LIB_DEBUG_PRINT_SAFE("Entering %p (o: %p, r: %i)\n", this, this->owner, this->recursion); 37 39 38 40 if( !this->owner ) { 39 41 //No one has the monitor, just take it 40 this->owner = thrd; 41 this->recursion = 1; 42 set_owner( this, thrd ); 42 43 } 43 44 else if( this->owner == thrd) { … … 77 78 lock( &this->lock ); 78 79 80 LIB_DEBUG_PRINT_SAFE("Leaving %p (o: %p, r: %i)\n", this, this->owner, this->recursion); 81 79 82 thread_desc * thrd = this_thread(); 80 assert ( thrd == this->owner || this->stack_owner);83 assertf( thrd == this->owner, "Expected owner to be %p, got %p (r: %i)", this->owner, thrd, this->recursion ); 81 84 82 85 //Leaving a recursion level, decrement the counter … … 86 89 //it means we don't need to do anything 87 90 if( this->recursion != 0) { 88 this->stack_owner = leader;91 // this->stack_owner = leader; 89 92 unlock( &this->lock ); 90 93 return; 91 94 } 92 95 93 // If we don't own the signal stack then just leave it to the owner94 if( this->stack_owner ) {95 this->stack_owner = leader;96 unlock( &this->lock );97 return;98 }96 // //If we don't own the signal stack then just leave it to the owner 97 // if( this->stack_owner ) { 98 // this->stack_owner = leader; 99 // unlock( &this->lock ); 100 // return; 101 // } 99 102 100 103 //We are the stack owner and have left the last recursion level. … … 108 111 //transfer control immediately 109 112 set_owner( this, new_owner ); 110 this->stack_owner = leader;113 // this->stack_owner = leader; 111 114 ScheduleInternal( &this->lock, new_owner ); 112 115 return; … … 118 121 set_owner( this, new_owner ); 119 122 120 // Update the stack owner121 this->stack_owner = leader;123 // //Update the stack owner 124 // this->stack_owner = leader; 122 125 123 126 //We can now let other threads in safely … … 138 141 static inline void leave(monitor_desc ** monitors, int count) { 139 142 __leave_monitor_desc( monitors[0], NULL ); 140 for(int i = count - 1; i >= 0; i--) {143 for(int i = count - 1; i >= 1; i--) { 141 144 __leave_monitor_desc( monitors[i], monitors[0] ); 142 145 } … … 166 169 // Internal scheduling 167 170 void wait( condition * this ) { 171 assertf(false, "NO SUPPORTED"); 168 172 // LIB_DEBUG_FPRINTF("Waiting\n"); 169 173 thread_desc * this_thrd = this_thread(); … … 236 240 237 241 static void __signal_internal( condition * this ) { 242 assertf(false, "NO SUPPORTED"); 238 243 if( !this->blocked.head ) return; 239 244
Note: See TracChangeset
for help on using the changeset viewer.