Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel_private.hfa

    r92e7631 r21184e3  
    1010// Created On       : Mon Feb 13 12:27:26 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Nov 30 19:25:02 2019
    13 // Update Count     : 8
     12// Last Modified On : Thu Mar 29 14:06:40 2018
     13// Update Count     : 3
    1414//
    1515
     
    3131}
    3232
    33 void __schedule_thread( $thread * ) __attribute__((nonnull (1)));
     33void ScheduleThread( thread_desc * );
     34static 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}
     43thread_desc * nextThread(cluster * this);
    3444
    3545//Block current thread and release/wake-up the following resources
    36 void __leave_thread() __attribute__((noreturn));
     46void BlockInternal(void);
     47void BlockInternal(__spinlock_t * lock);
     48void BlockInternal(thread_desc * thrd);
     49void BlockInternal(__spinlock_t * lock, thread_desc * thrd);
     50void BlockInternal(__spinlock_t * locks [], unsigned short count);
     51void BlockInternal(__spinlock_t * locks [], unsigned short count, thread_desc * thrds [], unsigned short thrd_count);
     52void BlockInternal(__finish_callback_fptr_t callback);
     53void LeaveThread(__spinlock_t * lock, thread_desc * thrd);
    3754
    3855//-----------------------------------------------------------------------------
     
    4057void main(processorCtx_t *);
    4158
    42 void * __create_pthread( pthread_t *, void * (*)(void *), void * );
     59static inline void wake_fast(processor * this) {
     60        __cfaabi_dbg_print_safe("Kernel : Waking up processor %p\n", this);
     61        post( this->idleLock );
     62}
    4363
    44 
     64static inline void wake(processor * this) {
     65        disable_interrupts();
     66        wake_fast(this);
     67        enable_interrupts( __cfaabi_dbg_ctx );
     68}
    4569
    4670struct event_kernel_t {
     
    6286// Threads
    6387extern "C" {
    64       void __cfactx_invoke_thread(void (*main)(void *), void * this);
     88      forall(dtype T | is_thread(T))
     89      void CtxInvokeThread(T * this);
    6590}
    6691
     92extern void ThreadCtxSwitch(coroutine_desc * src, coroutine_desc * dst);
     93
    6794__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 );
    7097)
    7198
     
    74101#define KERNEL_STORAGE(T,X) static char storage_##X[sizeof(T)]
    75102
    76 static inline uint32_t __tls_rand() {
     103static inline uint32_t tls_rand() {
    77104        kernelTLS.rand_seed ^= kernelTLS.rand_seed << 6;
    78105        kernelTLS.rand_seed ^= kernelTLS.rand_seed >> 21;
     
    85112void unregister( struct cluster & cltr );
    86113
    87 void doregister( struct cluster * cltr, struct $thread & thrd );
    88 void unregister( struct cluster * cltr, struct $thread & thrd );
     114void doregister( struct cluster * cltr, struct thread_desc & thrd );
     115void unregister( struct cluster * cltr, struct thread_desc & thrd );
    89116
    90117void doregister( struct cluster * cltr, struct processor * proc );
Note: See TracChangeset for help on using the changeset viewer.