- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/libcfa/concurrency/monitor.c
ra933dcf4 r9c59cd4 17 17 #include "monitor" 18 18 19 #include <stdlib>20 21 19 #include "kernel_private.h" 22 20 #include "libhdr.h" … … 132 130 this_thread()->current_monitors = this->prev_mntrs; 133 131 this_thread()->current_monitor_count = this->prev_count; 134 }135 136 void debug_break() __attribute__(( noinline ))137 {138 139 132 } 140 133 … … 178 171 179 172 //Find the next thread(s) to run 180 unsigned short thread_count = 0;173 unsigned short thread_count = count; 181 174 thread_desc * threads[ count ]; 182 for(int i = 0; i < count; i++) {183 threads[i] = 0;184 }185 186 debug_break();187 175 188 176 for( int i = 0; i < count; i++) { 189 177 thread_desc * new_owner = next_thread( this->monitors[i] ); 190 thread_count = insert_unique( threads, thread_count, new_owner ); 191 } 192 193 debug_break(); 178 thread_count = insert_unique( threads, i, new_owner ); 179 } 194 180 195 181 LIB_DEBUG_PRINT_SAFE("Will unblock: "); … … 353 339 LIB_DEBUG_PRINT_SAFE("Branding\n"); 354 340 assertf( thrd->current_monitors != NULL, "No current monitor to brand condition", thrd->current_monitors ); 341 this->monitors = thrd->current_monitors; 355 342 this->monitor_count = thrd->current_monitor_count; 356 357 this->monitors = malloc( this->monitor_count * sizeof( *this->monitors ) );358 for( int i = 0; i < this->monitor_count; i++ ) {359 this->monitors[i] = thrd->current_monitors[i];360 }361 343 } 362 344 } 363 345 364 346 static inline unsigned short insert_unique( thread_desc ** thrds, unsigned short end, thread_desc * val ) { 365 if( !val ) return end; 366 367 for(int i = 0; i <= end; i++) { 347 for(int i = 0; i < end; i++) { 368 348 if( thrds[i] == val ) return end; 369 349 }
Note: See TracChangeset
for help on using the changeset viewer.