From 7be79ed82e47606fa35a4ef58f11c4723d22087a Mon Sep 17 00:00:00 2001 From: bernie Date: Tue, 19 Oct 2004 08:55:31 +0000 Subject: [PATCH] Define forbid_cnt. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@246 38d2e660-2303-0410-9eaa-f027e97ec537 --- kern/proc.h | 22 ++++++++++++++++++---- kern/proc_p.h | 23 +++++++++++++++-------- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/kern/proc.h b/kern/proc.h index 3e73d493..a481fcbf 100755 --- a/kern/proc.h +++ b/kern/proc.h @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.7 2004/10/19 08:54:55 bernie + *#* Define forbid_cnt. + *#* *#* Revision 1.6 2004/10/03 20:44:18 bernie *#* Remove stale declarations (moved to monitor.h). *#* @@ -51,14 +54,25 @@ void proc_switch(void); void proc_test(void); struct Process* proc_current(void); IPTR proc_current_user_data(void); +void proc_rename(struct Process* proc, const char* name); #if CONFIG_KERN_PREEMPTIVE - #define FORBID proc_forbid() - #define PERMIT proc_permit() + void proc_forbid(void); + void proc_permit(void); #else - #define FORBID - #define PERMIT + INLINE void proc_forbid(void) { /* nop */ } + INLINE void proc_permit(void) { /* nop */ } #endif +/*! + * Execute a block of \a CODE atomically with respect to task scheduling. + */ +#define PROC_ATOMIC(CODE) \ + do { \ + proc_forbid(); \ + CODE; \ + proc_permit(); \ + } while(0) + #endif /* KERN_PROC_H */ diff --git a/kern/proc_p.h b/kern/proc_p.h index 5b0bc99a..d4961ebb 100755 --- a/kern/proc_p.h +++ b/kern/proc_p.h @@ -15,6 +15,9 @@ /*#* *#* $Log$ + *#* Revision 1.9 2004/10/19 08:55:31 bernie + *#* Define forbid_cnt. + *#* *#* Revision 1.8 2004/10/03 20:39:28 bernie *#* Import changes from sc/firmware. *#* @@ -73,6 +76,9 @@ typedef struct Process sigset_t sig_recv; /*!< Received signals */ #endif +#if CONFIG_PROC_PREEMPTIVE + int forbid_cnt; /*!< Nesting count for proc_forbid()/proc_permit(). */ + #if CONFIG_KERN_HEAP uint16_t flags; /*!< Flags */ cpustack_t *stack_base; /*!< Base of process stack */ @@ -93,26 +99,24 @@ typedef struct Process /*! - * \name Flags for Process.flags + * \name Flags for Process.flags. * \{ */ #define PF_FREESTACK BV(0) /*!< Free the stack when process dies */ /*\}*/ -/*! Track running processes */ +/*! Track running processes. */ extern REGISTER Process *CurrentProcess; -/*! Track ready processes */ +/*! Track ready processes. */ extern REGISTER List ProcReadyList; -/*! - * Enqueue a task in the ready list - */ +/*! Enqueue a task in the ready list. */ #define SCHED_ENQUEUE(proc) ADDTAIL(&ProcReadyList, &(proc)->link) -/*! Schedule to another process *without* adding the current to the ready list */ +/*! Schedule to another process *without* adding the current to the ready list. */ void proc_schedule(void); #if CONFIG_KERN_MONITOR @@ -122,8 +126,11 @@ void proc_schedule(void); /*! Register a process into the monitor */ void monitor_add(Process *proc, const char *name, cpustack_t *stack, size_t stacksize); - /*! Deregister a process from the monitor */ + /*! Unregister a process from the monitor */ void monitor_remove(Process *proc); + + /*! Rename a process */ + void monitor_rename(Process *proc, const char* name); #endif /* CONFIG_KERN_MONITOR */ #endif /* KERN_PROC_P_H */ -- 2.25.1