Changes in / [4233338b:0ac728b]
- Files:
-
- 2 added
- 3 deleted
- 8 edited
-
libcfa/src/concurrency/coroutine.hfa (modified) (2 diffs)
-
libcfa/src/concurrency/invoke.h (modified) (2 diffs)
-
libcfa/src/concurrency/kernel.cfa (modified) (2 diffs)
-
libcfa/src/concurrency/kernel/startup.cfa (modified) (5 diffs)
-
libcfa/src/concurrency/kernel_private.hfa (modified) (1 diff)
-
libcfa/src/concurrency/locks.hfa (modified) (4 diffs)
-
libcfa/src/concurrency/thread.hfa (modified) (2 diffs)
-
tests/meta/.expect/dumpable.txt (deleted)
-
tests/meta/dumpable.cfa (deleted)
-
tests/unified_locking/.expect/fast.txt (added)
-
tests/unified_locking/fast.cfa (added)
-
tests/unified_locking/mutex_test.hfa (modified) (4 diffs)
-
tests/zombies/fastlock.cfa (deleted)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/coroutine.hfa
r4233338b r0ac728b 10 10 // Created On : Mon Nov 28 12:27:26 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jan 6 16:33:16 202213 // Update Count : 1 212 // Last Modified On : Tue Feb 4 12:29:26 2020 13 // Update Count : 11 14 14 // 15 15 … … 155 155 156 156 if( unlikely(dst->context.SP == 0p) ) { 157 __stack_prepare(&dst->stack, DEFAULT_STACK_SIZE);157 __stack_prepare(&dst->stack, 65000); 158 158 __cfactx_start(main, dst, cor, __cfactx_invoke_coroutine); 159 159 } -
libcfa/src/concurrency/invoke.h
r4233338b r0ac728b 10 10 // Created On : Tue Jan 17 12:27:26 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jan 6 16:37:40 202213 // Update Count : 4 712 // Last Modified On : Thu Dec 5 16:26:03 2019 13 // Update Count : 44 14 14 // 15 15 … … 27 27 #ifndef _INVOKE_H_ 28 28 #define _INVOKE_H_ 29 30 enum { DEFAULT_STACK_SIZE = 65000 };31 29 32 30 struct __cfaehm_try_resume_node; -
libcfa/src/concurrency/kernel.cfa
r4233338b r0ac728b 142 142 extern void __disable_interrupts_hard(); 143 143 extern void __enable_interrupts_hard(); 144 145 static inline void __disable_interrupts_checked() { 146 /* paranoid */ verify( __preemption_enabled() ); 147 disable_interrupts(); 148 /* paranoid */ verify( ! __preemption_enabled() ); 149 } 150 151 static inline void __enable_interrupts_checked( bool poll = true ) { 152 /* paranoid */ verify( ! __preemption_enabled() ); 153 enable_interrupts( poll ); 154 /* paranoid */ verify( __preemption_enabled() ); 155 } 144 156 145 157 … … 764 776 // Unconditionnaly wake a thread 765 777 void __wake_proc(processor * this) { 766 /* paranoid */ verify( ! __preemption_enabled() );767 768 778 __cfadbg_print_safe(runtime_core, "Kernel : waking Processor %p\n", this); 769 779 770 eventfd_t val; 771 val = 1; 772 eventfd_write( this->idle_fd, val ); 773 774 /* paranoid */ verify( ! __preemption_enabled() ); 780 __disable_interrupts_checked(); 781 /* paranoid */ verify( ! __preemption_enabled() ); 782 eventfd_t val; 783 val = 1; 784 eventfd_write( this->idle_fd, val ); 785 __enable_interrupts_checked(); 775 786 } 776 787 -
libcfa/src/concurrency/kernel/startup.cfa
r4233338b r0ac728b 279 279 // When its coroutine terminates, it return control to the mainThread 280 280 // which is currently here 281 /* paranoid */ verify( !__atomic_load_n(&mainProcessor->do_terminate, __ATOMIC_ACQUIRE) );282 281 __atomic_store_n(&mainProcessor->do_terminate, true, __ATOMIC_RELEASE); 283 __wake_proc( mainProcessor );284 282 __kernel_last_resume( __cfaabi_tls.this_processor ); 285 283 mainThread->self_cor.state = Halted; … … 405 403 406 404 __cfaabi_tls.this_thread->curr_cor = dst; 407 __stack_prepare( &dst->stack, DEFAULT_STACK_SIZE);405 __stack_prepare( &dst->stack, 65000 ); 408 406 __cfactx_start(main, dst, this->runner, __cfactx_invoke_coroutine); 409 407 … … 566 564 extern size_t __page_size; 567 565 void ^?{}(processor & this) with( this ){ 568 /* paranoid */ verify( !__atomic_load_n(&do_terminate, __ATOMIC_ACQUIRE) ); 569 __cfadbg_print_safe(runtime_core, "Kernel : core %p signaling termination\n", &this); 570 571 __atomic_store_n(&do_terminate, true, __ATOMIC_RELAXED); 572 __disable_interrupts_checked(); 566 if( ! __atomic_load_n(&do_terminate, __ATOMIC_ACQUIRE) ) { 567 __cfadbg_print_safe(runtime_core, "Kernel : core %p signaling termination\n", &this); 568 569 __atomic_store_n(&do_terminate, true, __ATOMIC_RELAXED); 573 570 __wake_proc( &this ); 574 __enable_interrupts_checked(); 575 576 wait( terminated);577 /* paranoid */ verify( active_processor() != &this);571 572 wait( terminated ); 573 /* paranoid */ verify( active_processor() != &this); 574 } 578 575 579 576 __destroy_pthread( kernel_thread, this.stack, 0p ); … … 724 721 check( pthread_attr_init( &attr ), "pthread_attr_init" ); // initialize attribute 725 722 726 size_t stacksize = DEFAULT_STACK_SIZE; 723 size_t stacksize; 724 // default stack size, normally defined by shell limit 725 check( pthread_attr_getstacksize( &attr, &stacksize ), "pthread_attr_getstacksize" ); 726 assert( stacksize >= PTHREAD_STACK_MIN ); 727 727 728 728 void * stack; … … 749 749 #endif 750 750 751 751 752 check( pthread_attr_setstack( &attr, stack, stacksize ), "pthread_attr_setstack" ); 753 752 754 check( pthread_create( pthread, &attr, start, arg ), "pthread_create" ); 753 755 return stack; -
libcfa/src/concurrency/kernel_private.hfa
r4233338b r0ac728b 60 60 extern bool __preemption_enabled(); 61 61 62 static inline void __disable_interrupts_checked() {63 /* paranoid */ verify( __preemption_enabled() );64 disable_interrupts();65 /* paranoid */ verify( ! __preemption_enabled() );66 }67 68 static inline void __enable_interrupts_checked( bool poll = true ) {69 /* paranoid */ verify( ! __preemption_enabled() );70 enable_interrupts( poll );71 /* paranoid */ verify( __preemption_enabled() );72 }73 74 62 //release/wake-up the following resources 75 63 void __thread_finish( thread$ * thrd ); -
libcfa/src/concurrency/locks.hfa
r4233338b r0ac728b 177 177 }; 178 178 179 static inline void ?{}(fast_lock & this) __attribute__((deprecated("use linear_backoff_then_block_lock instead")));180 179 static inline void ?{}(fast_lock & this) { this.owner = 0p; } 181 180 … … 185 184 } 186 185 187 static inline void lock( fast_lock & this ) __attribute__(( deprecated("use linear_backoff_then_block_lock instead"),artificial));186 static inline void lock( fast_lock & this ) __attribute__((artificial)); 188 187 static inline void lock( fast_lock & this ) { 189 188 thread$ * thrd = active_thread(); … … 196 195 } 197 196 198 static inline bool try_lock( fast_lock & this ) __attribute__(( deprecated("use linear_backoff_then_block_lock instead"),artificial));197 static inline bool try_lock( fast_lock & this ) __attribute__((artificial)); 199 198 static inline bool try_lock ( fast_lock & this ) { 200 199 thread$ * thrd = active_thread(); … … 203 202 } 204 203 205 static inline thread$ * unlock( fast_lock & this ) __attribute__(( deprecated("use linear_backoff_then_block_lock instead"),artificial));204 static inline thread$ * unlock( fast_lock & this ) __attribute__((artificial)); 206 205 static inline thread$ * unlock( fast_lock & this ) { 207 206 /* paranoid */ verify(active_thread() == this.owner); -
libcfa/src/concurrency/thread.hfa
r4233338b r0ac728b 10 10 // Created On : Tue Jan 17 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jan 6 16:40:16 202213 // Update Count : 712 // Last Modified On : Wed Dec 4 09:18:14 2019 13 // Update Count : 6 14 14 // 15 15 … … 65 65 void ^?{}(thread$ & this); 66 66 67 static inline void ?{}(thread$ & this) { this{ "Anonymous Thread", *mainCluster, 0p, DEFAULT_STACK_SIZE}; }67 static inline void ?{}(thread$ & this) { this{ "Anonymous Thread", *mainCluster, 0p, 65000 }; } 68 68 static inline void ?{}(thread$ & this, size_t stackSize ) { this{ "Anonymous Thread", *mainCluster, 0p, stackSize }; } 69 69 static inline void ?{}(thread$ & this, void * storage, size_t storageSize ) { this{ "Anonymous Thread", *mainCluster, storage, storageSize }; } 70 static inline void ?{}(thread$ & this, struct cluster & cl ) { this{ "Anonymous Thread", cl, 0p, DEFAULT_STACK_SIZE}; }70 static inline void ?{}(thread$ & this, struct cluster & cl ) { this{ "Anonymous Thread", cl, 0p, 65000 }; } 71 71 static inline void ?{}(thread$ & this, struct cluster & cl, size_t stackSize ) { this{ "Anonymous Thread", cl, 0p, stackSize }; } 72 72 static inline void ?{}(thread$ & this, struct cluster & cl, void * storage, size_t storageSize ) { this{ "Anonymous Thread", cl, storage, storageSize }; } 73 static inline void ?{}(thread$ & this, const char * const name) { this{ name, *mainCluster, 0p, DEFAULT_STACK_SIZE}; }74 static inline void ?{}(thread$ & this, const char * const name, struct cluster & cl ) { this{ name, cl, 0p, DEFAULT_STACK_SIZE}; }73 static inline void ?{}(thread$ & this, const char * const name) { this{ name, *mainCluster, 0p, 65000 }; } 74 static inline void ?{}(thread$ & this, const char * const name, struct cluster & cl ) { this{ name, cl, 0p, 65000 }; } 75 75 static inline void ?{}(thread$ & this, const char * const name, struct cluster & cl, size_t stackSize ) { this{ name, cl, 0p, stackSize }; } 76 76 -
tests/unified_locking/mutex_test.hfa
r4233338b r0ac728b 10 10 thread$ * id; 11 11 uint32_t sum; 12 uint32_t cnt;13 12 }; 14 13 … … 28 27 { 29 28 uint32_t tsum = mo.sum; 30 uint32_t cnt = mo.cnt;31 29 mo.id = me; 32 30 yield(random(5)); 33 31 value = ((uint32_t)random()) ^ ((uint32_t)me); 34 32 if(mo.id != me) sout | "Intruder!"; 35 mo.cnt = cnt + 1;36 33 mo.sum = tsum + value; 37 34 } … … 57 54 uint32_t sum = -32; 58 55 mo.sum = -32; 59 mo.cnt = 0;60 56 processor p[2]; 61 57 sout | "Starting"; … … 67 63 } 68 64 sout | "Done!"; 69 if(mo.cnt != (13 * num_times)) sout | "Invalid cs count!" | mo.cnt | "vs "| (13 * num_times) | "(13 *" | num_times | ')';70 65 if(sum == mo.sum) sout | "Match!"; 71 66 else sout | "No Match!" | sum | "vs" | mo.sum;
Note:
See TracChangeset
for help on using the changeset viewer.