Define forbid_cnt.
authorbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 19 Oct 2004 08:55:31 +0000 (08:55 +0000)
committerbernie <bernie@38d2e660-2303-0410-9eaa-f027e97ec537>
Tue, 19 Oct 2004 08:55:31 +0000 (08:55 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@246 38d2e660-2303-0410-9eaa-f027e97ec537

kern/proc.h
kern/proc_p.h

index 3e73d493d246ecac4b8279d7f53098de128b84bc..a481fcbf4ee201e3caf7c59c323567447e556ca8 100755 (executable)
@@ -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 */
 
index 5b0bc99a28235bcba7300de15ecec9eed3ef2c50..d4961ebb1d1b36c1510d5f6d4ffee42a541e0cec 100755 (executable)
@@ -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 */