X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fkern%2Fproc.h;h=0cf3bac2a77f8473fc649dc81c787557ab96ea28;hb=bbc9b62788f5e2f94dd550708a6af22f6d49eb98;hp=13bd7bf018f934334e6bd1e8fc01b0a2e098fd84;hpb=1c11ac0ab0636d07db3899b02c5d89e2d0b020bc;p=bertos.git diff --git a/bertos/kern/proc.h b/bertos/kern/proc.h index 13bd7bf0..0cf3bac2 100644 --- a/bertos/kern/proc.h +++ b/bertos/kern/proc.h @@ -30,14 +30,57 @@ * Copyright 1999, 2000, 2001, 2008 Bernie Innocenti * --> * - * \defgroup kern Kernel facilities - * \{ - * * \defgroup kern_proc Process (Threads) management + * \ingroup kern * \{ * * \brief BeRTOS Kernel core (Process scheduler). * + * This is the core kernel module. It allows you to create new processes + * (which are called \b threads in other systems) and set the priority of + * each process. + * + * A process needs a work area (called \b stack) to run. To create a process, + * you need to declare a stack area, then create the process. + * You may also pass NULL for the stack area, if you have enabled kernel heap: + * in this case the stack will be automatically allocated. + * + * Example: + * \code + * PROC_DEFINE_STACK(stack1, 200); + * + * void NORETURN proc1_run(void) + * { + * while (1) + * { + * LOG_INFO("I'm alive!\n"); + * timer_delay(1000); + * } + * } + * + * + * int main() + * { + * Process *p1 = proc_new(proc1_run, NULL, stack1, sizeof(stack1)); + * // here the process is already running + * proc_setPri(p1, 2); + * // ... + * } + * \endcode + * + * The Process struct must be regarded as an opaque data type, do not access + * any of its members directly. + * + * The entry point function should be declared as NORETURN, because it will + * remove a warning and enable compiler optimizations. + * + * You can temporarily disable preemption calling proc_forbid(); remember + * to enable it again calling proc_permit(). + * + * \note You should hardly need to manually release the CPU; however you + * can do it using the cpu_relax() function. It is illegal to release + * the CPU with preemption disabled. + * * \author Bernie Innocenti * * $WIZ$ module_name = "kernel" @@ -79,8 +122,7 @@ typedef struct Process iptr_t user_data; /**< Custom data passed to the process */ #if CONFIG_KERN_SIGNALS - sigmask_t sig_wait; /**< Signals the process is waiting for */ - sigmask_t sig_recv; /**< Received signals */ + Signal sig; #endif #if CONFIG_KERN_HEAP @@ -143,7 +185,7 @@ struct Process *proc_new_with_name(const char *name, void (*entry)(void), iptr_t */ void proc_exit(void); -/** +/* * Public scheduling class methods. */ void proc_yield(void); @@ -403,6 +445,5 @@ INLINE struct Process *proc_current(void) #endif #endif /** \} */ //defgroup kern_proc -/** \} */ //defgroup kern #endif /* KERN_PROC_H */