- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel_private.hfa
r92e7631 r21184e3 10 10 // Created On : Mon Feb 13 12:27:26 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Nov 30 19:25:02 201913 // Update Count : 812 // Last Modified On : Thu Mar 29 14:06:40 2018 13 // Update Count : 3 14 14 // 15 15 … … 31 31 } 32 32 33 void __schedule_thread( $thread * ) __attribute__((nonnull (1))); 33 void ScheduleThread( thread_desc * ); 34 static inline void WakeThread( thread_desc * thrd ) { 35 if( !thrd ) return; 36 37 verify(thrd->state == Inactive); 38 39 disable_interrupts(); 40 ScheduleThread( thrd ); 41 enable_interrupts( __cfaabi_dbg_ctx ); 42 } 43 thread_desc * nextThread(cluster * this); 34 44 35 45 //Block current thread and release/wake-up the following resources 36 void __leave_thread() __attribute__((noreturn)); 46 void BlockInternal(void); 47 void BlockInternal(__spinlock_t * lock); 48 void BlockInternal(thread_desc * thrd); 49 void BlockInternal(__spinlock_t * lock, thread_desc * thrd); 50 void BlockInternal(__spinlock_t * locks [], unsigned short count); 51 void BlockInternal(__spinlock_t * locks [], unsigned short count, thread_desc * thrds [], unsigned short thrd_count); 52 void BlockInternal(__finish_callback_fptr_t callback); 53 void LeaveThread(__spinlock_t * lock, thread_desc * thrd); 37 54 38 55 //----------------------------------------------------------------------------- … … 40 57 void main(processorCtx_t *); 41 58 42 void * __create_pthread( pthread_t *, void * (*)(void *), void * ); 59 static inline void wake_fast(processor * this) { 60 __cfaabi_dbg_print_safe("Kernel : Waking up processor %p\n", this); 61 post( this->idleLock ); 62 } 43 63 44 64 static inline void wake(processor * this) { 65 disable_interrupts(); 66 wake_fast(this); 67 enable_interrupts( __cfaabi_dbg_ctx ); 68 } 45 69 46 70 struct event_kernel_t { … … 62 86 // Threads 63 87 extern "C" { 64 void __cfactx_invoke_thread(void (*main)(void *), void * this); 88 forall(dtype T | is_thread(T)) 89 void CtxInvokeThread(T * this); 65 90 } 66 91 92 extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst); 93 67 94 __cfaabi_dbg_debug_do( 68 extern void __cfaabi_dbg_thread_register ( $thread* thrd );69 extern void __cfaabi_dbg_thread_unregister( $thread* thrd );95 extern void __cfaabi_dbg_thread_register ( thread_desc * thrd ); 96 extern void __cfaabi_dbg_thread_unregister( thread_desc * thrd ); 70 97 ) 71 98 … … 74 101 #define KERNEL_STORAGE(T,X) static char storage_##X[sizeof(T)] 75 102 76 static inline uint32_t __tls_rand() {103 static inline uint32_t tls_rand() { 77 104 kernelTLS.rand_seed ^= kernelTLS.rand_seed << 6; 78 105 kernelTLS.rand_seed ^= kernelTLS.rand_seed >> 21; … … 85 112 void unregister( struct cluster & cltr ); 86 113 87 void doregister( struct cluster * cltr, struct $thread& thrd );88 void unregister( struct cluster * cltr, struct $thread& thrd );114 void doregister( struct cluster * cltr, struct thread_desc & thrd ); 115 void unregister( struct cluster * cltr, struct thread_desc & thrd ); 89 116 90 117 void doregister( struct cluster * cltr, struct processor * proc );
Note:
See TracChangeset
for help on using the changeset viewer.