Changeset cc287800 for libcfa/src/concurrency
- Timestamp:
- Nov 8, 2021, 5:28:21 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 36a05d7
- Parents:
- 949339b (diff), 5ee153d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- libcfa/src/concurrency
- Files:
-
- 6 edited
-
io.cfa (modified) (2 diffs)
-
io/types.hfa (modified) (1 diff)
-
kernel.cfa (modified) (6 diffs)
-
kernel/startup.cfa (modified) (2 diffs)
-
monitor.hfa (modified) (1 diff)
-
mutex_stmt.hfa (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r949339b rcc287800 183 183 ctx.proc->io.pending = false; 184 184 185 ready_schedule_lock();186 185 __cfa_io_drain( proc ); 187 ready_schedule_unlock();188 186 // for(i; 2) { 189 187 // unsigned idx = proc->rdq.id + i; … … 311 309 // Make the sqes visible to the submitter 312 310 __atomic_store_n(sq.kring.tail, tail + have, __ATOMIC_RELEASE); 313 sq.to_submit ++;311 sq.to_submit += have; 314 312 315 313 ctx->proc->io.pending = true; 316 314 ctx->proc->io.dirty = true; 317 315 if(sq.to_submit > 30 || !lazy) { 316 ready_schedule_lock(); 318 317 __cfa_io_flush( ctx->proc ); 318 ready_schedule_unlock(); 319 319 } 320 320 } -
libcfa/src/concurrency/io/types.hfa
r949339b rcc287800 188 188 return wait(this.self); 189 189 } 190 191 void reset( io_future_t & this ) { 192 return reset(this.self); 193 } 190 194 } -
libcfa/src/concurrency/kernel.cfa
r949339b rcc287800 196 196 197 197 if( !readyThread ) { 198 ready_schedule_lock(); 198 199 __cfa_io_flush( this ); 200 ready_schedule_unlock(); 201 199 202 readyThread = __next_thread_slow( this->cltr ); 200 203 } … … 277 280 278 281 if(this->io.pending && !this->io.dirty) { 282 ready_schedule_lock(); 279 283 __cfa_io_flush( this ); 284 ready_schedule_unlock(); 280 285 } 281 286 … … 317 322 318 323 // Don't block if we are done 319 if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) break MAIN_LOOP; 324 if( __atomic_load_n(&this->do_terminate, __ATOMIC_SEQ_CST) ) { 325 ready_schedule_unlock(); 326 break MAIN_LOOP; 327 } 320 328 321 329 __STATS( __tls_stats()->ready.sleep.halts++; ) … … 939 947 /* paranoid */ verifyf( it, "Unexpected null iterator, at index %u of %u\n", i, count); 940 948 /* paranoid */ verify( it->local_data->this_stats ); 949 // __print_stats( it->local_data->this_stats, cltr->print_stats, "Processor", it->name, (void*)it ); 941 950 __tally_stats( cltr->stats, it->local_data->this_stats ); 942 951 it = &(*it)`next; … … 948 957 // this doesn't solve all problems but does solve many 949 958 // so it's probably good enough 959 disable_interrupts(); 950 960 uint_fast32_t last_size = ready_mutate_lock(); 951 961 … … 955 965 // Unlock the RWlock 956 966 ready_mutate_unlock( last_size ); 967 enable_interrupts(); 957 968 } 958 969 -
libcfa/src/concurrency/kernel/startup.cfa
r949339b rcc287800 100 100 // Other Forward Declarations 101 101 extern void __wake_proc(processor *); 102 extern int cfa_main_returned; // from interpose.cfa 102 103 103 104 //----------------------------------------------------------------------------- … … 268 269 269 270 static void __kernel_shutdown(void) { 271 if(!cfa_main_returned) return; 270 272 /* paranoid */ verify( __preemption_enabled() ); 271 273 disable_interrupts(); -
libcfa/src/concurrency/monitor.hfa
r949339b rcc287800 65 65 free( th ); 66 66 } 67 68 static inline forall( T & | sized(T) | { void ^?{}( T & mutex ); } ) 69 void adelete( T arr[] ) { 70 if ( arr ) { // ignore null 71 size_t dim = malloc_size( arr ) / sizeof( T ); 72 for ( int i = dim - 1; i >= 0; i -= 1 ) { // reverse allocation order, must be unsigned 73 ^(arr[i]){}; // run destructor 74 } // for 75 free( arr ); 76 } // if 77 } // adelete 67 78 68 79 //----------------------------------------------------------------------------- -
libcfa/src/concurrency/mutex_stmt.hfa
r949339b rcc287800 1 1 #include "bits/algorithm.hfa" 2 #include <assert.h> 3 #include "invoke.h" 4 #include "stdlib.hfa" 5 #include <stdio.h> 2 #include "bits/defs.hfa" 6 3 7 4 //-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.