Ignore:
Timestamp:
Jan 4, 2018, 10:05:47 AM (4 years ago)
Author:
alain
Message:

Improve sys_exec.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kernel/kern/scheduler.h

    r409 r416  
    4040typedef struct scheduler_s
    4141{
    42     spinlock_t        lock;         /*! readlock protecting lists of threads                */
    43     uint16_t          u_threads_nr; /*! total numbre of attached user threads               */
    44     uint16_t          k_threads_nr; /*! total number of attached kernel threads             */
    45     list_entry_t      u_root;       /*! root of list of user threads for this scheduler     */
    46     list_entry_t      k_root;       /*! root of list of kernel threads for this scheduler   */
    47     list_entry_t    * u_last;       /*! pointer on list_entry for last executed k_thread    */
    48     list_entry_t    * k_last;       /*! pointer on list entry for last executed u_thread    */
    49     struct thread_s * idle;         /*! pointer on idle thread                              */
    50     struct thread_s * current;      /*! pointer on current running thread                   */
    51     bool_t            sig_pending;  /*! signal_handller must be called when true            */
     42    spinlock_t        lock;            /*! readlock protecting lists of threads             */
     43    uint16_t          u_threads_nr;    /*! total number of attached user threads            */
     44    uint16_t          k_threads_nr;    /*! total number of attached kernel threads          */
     45    list_entry_t      u_root;          /*! root of list of user threads                     */
     46    list_entry_t      k_root;          /*! root of list of kernel threads                   */
     47    list_entry_t    * u_last;          /*! pointer on list_entry for last executed k_thread */
     48    list_entry_t    * k_last;          /*! pointer on list entry for last executed u_thread */
     49    struct thread_s * idle;            /*! pointer on idle thread                           */
     50    struct thread_s * current;         /*! pointer on current running thread                */
     51    bool_t            req_ack_pending; /*! signal_handller must be called when true         */
    5252}
    5353scheduler_t;
     
    6767                            struct thread_s * thread );
    6868
    69 /*********************************************************************************************
    70  * This function remove a thread from its scheduler.re scheduler.
    71  *********************************************************************************************
    72  * @ thread  : local pointer on the thread descriptor.
    73  ********************************************************************************************/ 
    74 void sched_remove_thread( struct thread_s * thread );
    75 
    7669/*********************************************************************************************
    7770 * This function is the only method to make a context switch. It is called in cas of TICK,
     
    8780
    8881/*********************************************************************************************
    89  * This function scan all threads attached to a given core scheduler, and executes
    90  * the relevant actions for pending KILL or EXIT signals.
    91  * It is called in by the sched_yield() function, with IRQ disabled.
     82 * This function scan all threads attached to a given scheduler, and executes the relevant
     83 * actions for pending THREAD_FLAG_REQ_ACK or THREAD_FLAG_REQ_DELETE requests.
     84 * It is called in by the sched_yield() function, with IRQ disabled.
     85 * - REQ_ACK : it checks that target thread is blocked, decrements the response counter
     86 *   to acknowledge the client thread, and reset the pending request.
     87 * - REQ_DELETE : it detach the target thread from parent if attached, detach it from
     88 *   the process, remove it from scheduler, release memory allocated to thread descriptor,
     89 *   and destroy the process descriptor it the target thread was the last thread.
    9290 *********************************************************************************************
    9391 * @ core    : local pointer on the core descriptor.
    9492 ********************************************************************************************/
    95 void sched_handle_signals( struct core_s * core );
     93void sched_handle_requests( struct core_s * core );
    9694
    9795/*********************************************************************************************
     
    113111
    114112/*********************************************************************************************
    115  * This function unlink a thread identified by the <thread> pointer from its process.
    116  * It is called by the sched_handle_signals() function when one EXIT or KILL signal is set,
    117  * and it implement the first step of a thread destructionebut can also be directly called by a local killer thread signal.
    118  * - It detach the thread from the scheduler.
    119  * - It detach the thread from the process.
    120  * - It detach the thread from the parent thread when the thread is attached.
    121  * - It destroys the thread descriptor.
    122  * - It acknowledge the killer thread if it's a kill signal
    123  *********************************************************************************************
    124  * @ thread   : pointer on thread to be killed.
    125  ********************************************************************************************/
    126 void sched_kill_thread( struct thread_s * thread );
    127 
    128 /*********************************************************************************************
    129113 * This function display the internal state of the local core identified by its <lid>.
    130114 *********************************************************************************************
Note: See TracChangeset for help on using the changeset viewer.