Changeset 70527f1 in mainline for src/proc/thread.c


Ignore:
Timestamp:
2005-06-03T14:51:05Z (20 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
673104e
Parents:
ac5d02b
Message:

doxygen-style comments
cleanups

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/proc/thread.c

    rac5d02b r70527f1  
    5151#include <arch/faddr.h>
    5252
    53 char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"};
     53char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */
    5454
    5555spinlock_t threads_lock;
     
    5959__u32 last_tid = 0;
    6060
    61 /*
    62  * cushion() is provided to ensure that every thread
     61
     62/** Thread wrapper
     63 *
     64 * This wrapper is provided to ensure that every thread
    6365 * makes a call to thread_exit() when its implementing
    6466 * function returns.
    6567 *
    66  * cpu_priority_high()'d
     68 * cpu_priority_high() is assumed.
     69 *
    6770 */
    6871void cushion(void)
     
    8285}
    8386
     87
     88/** Initialize threads
     89 *
     90 * Initialize kernel threads support.
     91 *
     92 */
    8493void thread_init(void)
    8594{
     
    9099}
    91100
     101
     102/** Make thread ready
     103 *
     104 * Switch thread t to the ready state.
     105 *
     106 * @param t Thread to make ready.
     107 *
     108 */
    92109void thread_ready(thread_t *t)
    93110{
     
    109126        spinlock_unlock(&t->lock);
    110127       
    111         /*
     128        /*
    112129         * Append t to respective ready queue on respective processor.
    113130         */
     
    134151}
    135152
     153
     154/** Create new thread
     155 *
     156 * Create a new thread.
     157 *
     158 * @param func  Thread's implementing function.
     159 * @param arg   Thread's implementing function argument.
     160 * @param task  Task to which the thread belongs.
     161 * @param flags Thread flags.
     162 *
     163 * @return New thread's structure on success, NULL on failure.
     164 *
     165 */
    136166thread_t *thread_create(void (* func)(void *), void *arg, task_t *task, int flags)
    137167{
     
    214244}
    215245
     246
     247/** Make thread exiting
     248 *
     249 * End current thread execution and switch it to the exiting
     250 * state. All pending timeouts are executed.
     251 *
     252 */
    216253void thread_exit(void)
    217254{
     
    231268}
    232269
     270
     271/** Thread sleep
     272 *
     273 * Suspend execution of the current thread.
     274 *
     275 * @param sec Number of seconds to sleep.
     276 *
     277 */
    233278void thread_sleep(__u32 sec)
    234279{
    235280        thread_usleep(sec*1000000);
    236281}
    237        
    238 /*
    239  * Suspend execution of current thread for usec microseconds.
    240  */
     282
     283
     284/** Thread usleep
     285 *
     286 * Suspend execution of the current thread.
     287 *
     288 * @param usec Number of microseconds to sleep.
     289 *
     290 */     
    241291void thread_usleep(__u32 usec)
    242292{
     
    248298}
    249299
     300
     301/** Register thread out-of-context invocation
     302 *
     303 * Register a function and its argument to be executed
     304 * on next context switch to the current thread.
     305 *
     306 * @param call_me      Out-of-context function.
     307 * @param call_me_with Out-of-context function argument.
     308 *
     309 */
    250310void thread_register_call_me(void (* call_me)(void *), void *call_me_with)
    251311{
Note: See TracChangeset for help on using the changeset viewer.