summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorAllan Stephens <allan.stephens@windriver.com>2016-10-25 09:30:19 -0500
committerAndrew Boie <andrew.p.boie@intel.com>2016-10-26 17:03:12 +0000
commit2220f25f0a6271a0c51f30ef44d9d6ce74c77b9f (patch)
tree33992d7a68fa0f421bdf3894ccac295a1152c902 /arch
parent92e75040a22d01a26bb8dc0934d4cf6be5c9a2fb (diff)
kernel: Standardize thread monitoring initialization
Gets rid of unnecessary THREAD_MONITOR_INIT() macro, to be consistent with the approach taken by _thread_monitor_exit(). Aligns x86 code with the approach used on other architectures. Revises the associated comments and removes unnecessary doxygen tags. Change-Id: Ied1aebcd476afb82f61862b77264efb8a7dc66c9 Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arc/core/thread.c27
-rw-r--r--arch/arm/core/thread.c34
-rw-r--r--arch/nios2/core/thread.c27
-rw-r--r--arch/x86/core/thread.c37
4 files changed, 40 insertions, 85 deletions
diff --git a/arch/arc/core/thread.c b/arch/arc/core/thread.c
index e66c6108a..3ce8f0f5c 100644
--- a/arch/arc/core/thread.c
+++ b/arch/arc/core/thread.c
@@ -43,37 +43,22 @@ struct init_stack_frame {
tNANO _nanokernel = {0};
#if defined(CONFIG_THREAD_MONITOR)
-#define THREAD_MONITOR_INIT(tcs) thread_monitor_init(tcs)
-#else
-#define THREAD_MONITOR_INIT(tcs) \
- do {/* do nothing */ \
- } while ((0))
-#endif
-
-#if defined(CONFIG_THREAD_MONITOR)
/*
- * @brief Initialize thread monitoring support
- *
- * Currently only inserts the new thread in the list of active threads.
- *
- * @return N/A
+ * Add a thread to the kernel's list of active threads.
*/
-
static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
{
unsigned int key;
- /*
- * Add the newly initialized thread to head of the list of threads. This
- * singly linked list of threads maintains ALL the threads in the system:
- * both tasks and fibers regardless of whether they are runnable.
- */
-
key = irq_lock();
tcs->next_thread = _nanokernel.threads;
_nanokernel.threads = tcs;
irq_unlock(key);
}
+#else
+#define thread_monitor_init(tcs) \
+ do {/* do nothing */ \
+ } while ((0))
#endif /* CONFIG_THREAD_MONITOR */
/*
@@ -187,5 +172,5 @@ void _new_thread(char *pStackMem, unsigned stackSize,
/* initial values in all other registers/TCS entries are irrelevant */
- THREAD_MONITOR_INIT(tcs);
+ thread_monitor_init(tcs);
}
diff --git a/arch/arm/core/thread.c b/arch/arm/core/thread.c
index d70df2358..3f07b99ed 100644
--- a/arch/arm/core/thread.c
+++ b/arch/arm/core/thread.c
@@ -34,40 +34,22 @@
tNANO _nanokernel = {0};
#if defined(CONFIG_THREAD_MONITOR)
-#define THREAD_MONITOR_INIT(tcs) _thread_monitor_init(tcs)
-#else
-#define THREAD_MONITOR_INIT(tcs) \
- do {/* do nothing */ \
- } while ((0))
-#endif
-
-#if defined(CONFIG_THREAD_MONITOR)
-/**
- *
- * @brief Initialize thread monitoring support
- *
- * Currently only inserts the new thread in the list of active threads.
- *
- * @return N/A
+/*
+ * Add a thread to the kernel's list of active threads.
*/
-
-static ALWAYS_INLINE void _thread_monitor_init(struct tcs *tcs /* thread */
- )
+static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
{
unsigned int key;
- /*
- * Add the newly initialized thread to head of the list of threads.
- * This singly linked list of threads maintains ALL the threads in the
- * system:
- * both tasks and fibers regardless of whether they are runnable.
- */
-
key = irq_lock();
tcs->next_thread = _nanokernel.threads;
_nanokernel.threads = tcs;
irq_unlock(key);
}
+#else
+#define thread_monitor_init(tcs) \
+ do {/* do nothing */ \
+ } while ((0))
#endif /* CONFIG_THREAD_MONITOR */
/**
@@ -171,5 +153,5 @@ void _new_thread(char *pStackMem, unsigned stackSize,
/* initial values in all other registers/TCS entries are irrelevant */
- THREAD_MONITOR_INIT(tcs);
+ thread_monitor_init(tcs);
}
diff --git a/arch/nios2/core/thread.c b/arch/nios2/core/thread.c
index ac4568181..1eeaa2d74 100644
--- a/arch/nios2/core/thread.c
+++ b/arch/nios2/core/thread.c
@@ -22,37 +22,22 @@
tNANO _nanokernel = {0};
#if defined(CONFIG_THREAD_MONITOR)
-#define THREAD_MONITOR_INIT(tcs) thread_monitor_init(tcs)
-#else
-#define THREAD_MONITOR_INIT(tcs) \
- do {/* do nothing */ \
- } while ((0))
-#endif
-
-#if defined(CONFIG_THREAD_MONITOR)
/*
- * @brief Initialize thread monitoring support
- *
- * Currently only inserts the new thread in the list of active threads.
- *
- * @return N/A
+ * Add a thread to the kernel's list of active threads.
*/
-
static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
{
unsigned int key;
- /*
- * Add the newly initialized thread to head of the list of threads. This
- * singly linked list of threads maintains ALL the threads in the system:
- * both tasks and fibers regardless of whether they are runnable.
- */
-
key = irq_lock();
tcs->next_thread = _nanokernel.threads;
_nanokernel.threads = tcs;
irq_unlock(key);
}
+#else
+#define thread_monitor_init(tcs) \
+ do {/* do nothing */ \
+ } while ((0))
#endif /* CONFIG_THREAD_MONITOR */
/* forward declaration to asm function to adjust setup the arguments
@@ -131,5 +116,5 @@ void _new_thread(char *stack_memory, unsigned stack_size,
_nano_timeout_tcs_init(tcs);
#endif
- THREAD_MONITOR_INIT(tcs);
+ thread_monitor_init(tcs);
}
diff --git a/arch/x86/core/thread.c b/arch/x86/core/thread.c
index 8e2566018..f03e457e6 100644
--- a/arch/x86/core/thread.c
+++ b/arch/x86/core/thread.c
@@ -49,6 +49,25 @@ void _thread_entry_wrapper(_thread_entry_t, void *,
void *, void *);
#endif
+#if defined(CONFIG_THREAD_MONITOR)
+/*
+ * Add a thread to the kernel's list of active threads.
+ */
+static ALWAYS_INLINE void thread_monitor_init(struct tcs *tcs)
+{
+ unsigned int key;
+
+ key = irq_lock();
+ tcs->next_thread = _nanokernel.threads;
+ _nanokernel.threads = tcs;
+ irq_unlock(key);
+}
+#else
+#define thread_monitor_init(tcs) \
+ do {/* do nothing */ \
+ } while ((0))
+#endif /* CONFIG_THREAD_MONITOR */
+
/**
*
* @brief Initialize a new execution thread
@@ -207,23 +226,7 @@ static void _new_thread_internal(char *pStackMem, unsigned stackSize,
PRINTK("\nstruct tcs * = 0x%x", tcs);
-#if defined(CONFIG_THREAD_MONITOR)
- {
- unsigned int imask;
-
- /*
- * Add the newly initialized thread to head of the list of threads.
- * This singly linked list of threads maintains ALL the threads in the
- * system: both tasks and fibers regardless of whether they are
- * runnable.
- */
-
- imask = irq_lock();
- tcs->next_thread = _nanokernel.threads;
- _nanokernel.threads = tcs;
- irq_unlock(imask);
- }
-#endif /* CONFIG_THREAD_MONITOR */
+ thread_monitor_init(tcs);
_nano_timeout_tcs_init(tcs);
}