summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-22 18:28:53 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2008-01-22 18:28:53 +0000
commit3168deaa10fae157b38a94c5204a66d28a43ad7a (patch)
tree0bda84e785960fa6641c2b167d626cf3271b3352 /cpukit/score/include
parent2008-01-22 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-3168deaa10fae157b38a94c5204a66d28a43ad7a.tar.bz2
2008-01-22 Joel Sherrill <joel.sherrill@oarcorp.com>
* rtems/include/rtems/rtems/event.h, rtems/inline/rtems/rtems/eventset.inl, rtems/src/event.c, rtems/src/eventseize.c, rtems/src/eventsurrender.c, rtems/src/eventtimeout.c, score/Makefile.am, score/preinstall.am, score/include/rtems/score/interr.h, score/include/rtems/score/thread.h, score/include/rtems/score/threadq.h, score/include/rtems/score/tqdata.h, score/inline/rtems/score/threadq.inl, score/inline/rtems/score/tqdata.inl, score/src/threadq.c, score/src/threadqdequeue.c, score/src/threadqdequeuefifo.c, score/src/threadqdequeuepriority.c, score/src/threadqenqueue.c, score/src/threadqenqueuefifo.c, score/src/threadqenqueuepriority.c, score/src/threadqextract.c, score/src/threadqextractfifo.c, score/src/threadqextractpriority.c, score/src/threadqextractwithproxy.c, score/src/threadqfirst.c, score/src/threadqfirstfifo.c, score/src/threadqfirstpriority.c, score/src/threadqflush.c, score/src/threadqrequeue.c, score/src/threadqtimeout.c: Refactor thread queue enqueue and event blocking synchronization critical sections. This resulted in three copies of essentially the same hard to test critical section code becoming the one shared routine _Thread_blocking_operation_Cancel. In addition, the thread queue and event code now share a common synchronization enumerated type. Along the way, switches were reworked to eliminate dead code generated by gcc and comments and copyrights were updated. * score/include/rtems/score/threadsync.h, score/src/threadblockingoperationcancel.c: New files.
Diffstat (limited to 'cpukit/score/include')
-rw-r--r--cpukit/score/include/rtems/score/interr.h3
-rw-r--r--cpukit/score/include/rtems/score/thread.h23
-rw-r--r--cpukit/score/include/rtems/score/threadq.h12
-rw-r--r--cpukit/score/include/rtems/score/threadsync.h58
-rw-r--r--cpukit/score/include/rtems/score/tqdata.h16
5 files changed, 92 insertions, 20 deletions
diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h
index 323bc06818..a8792c334b 100644
--- a/cpukit/score/include/rtems/score/interr.h
+++ b/cpukit/score/include/rtems/score/interr.h
@@ -63,7 +63,8 @@ typedef enum {
INTERNAL_ERROR_INVALID_GLOBAL_ID,
INTERNAL_ERROR_BAD_STACK_HOOK,
INTERNAL_ERROR_BAD_ATTRIBUTES,
- INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY
+ INTERNAL_ERROR_IMPLEMENTATION_KEY_CREATE_INCONSISTENCY,
+ INTERNAL_ERROR_IMPLEMENTATION_BLOCKING_OPERATION_CANCEL
} Internal_errors_Core_list;
/**
diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
index 9b9f324b9e..fcf26c9507 100644
--- a/cpukit/score/include/rtems/score/thread.h
+++ b/cpukit/score/include/rtems/score/thread.h
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2007.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -785,6 +785,27 @@ Thread_Control *_Thread_Get (
Objects_Locations *location
);
+/**
+ * @brief Cancel a blocking operation due to ISR
+ *
+ * This method is used to cancel a blocking operation that was
+ * satisfied from an ISR while the thread executing was in the
+ * process of blocking.
+ *
+ * @param[in] sync_state is the synchronization state
+ * @param[in] the_thread is the thread whose blocking is canceled
+ * @param[in] level is the previous ISR disable level
+ *
+ * @note This is a rare routine in RTEMS. It is called with
+ * interrupts disabled and only when an ISR completed
+ * a blocking condition in process.
+ */
+void _Thread_blocking_operation_Cancel(
+ Thread_blocking_operation_States sync_state,
+ Thread_Control *the_thread,
+ ISR_Level level
+);
+
#ifndef __RTEMS_APPLICATION__
#include <rtems/score/thread.inl>
#endif
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h
index 7b609285eb..2345087c04 100644
--- a/cpukit/score/include/rtems/score/threadq.h
+++ b/cpukit/score/include/rtems/score/threadq.h
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -178,9 +178,10 @@ Thread_Control *_Thread_queue_Dequeue_priority(
* the_thread_queue with an optional timeout using the
* priority discipline.
*/
-void _Thread_queue_Enqueue_priority(
+Thread_blocking_operation_States _Thread_queue_Enqueue_priority (
Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ ISR_Level *level_p
);
/** @brief Thread queue Extract priority Helper
@@ -230,9 +231,10 @@ Thread_Control *_Thread_queue_Dequeue_fifo(
* the_thread_queue with an optional timeout using the
* FIFO discipline.
*/
-void _Thread_queue_Enqueue_fifo(
+Thread_blocking_operation_States _Thread_queue_Enqueue_fifo (
Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread
+ Thread_Control *the_thread,
+ ISR_Level *level_p
);
/** @brief Thread queue Extract FIFO
diff --git a/cpukit/score/include/rtems/score/threadsync.h b/cpukit/score/include/rtems/score/threadsync.h
new file mode 100644
index 0000000000..6902f7b33b
--- /dev/null
+++ b/cpukit/score/include/rtems/score/threadsync.h
@@ -0,0 +1,58 @@
+/**
+ * @file rtems/score/threadsync.h
+ *
+ * This include file contains all constants and structures associated
+ * with synchronizing a thread blocking operation with potential
+ * actions in an ISR.
+ */
+
+/*
+ * COPYRIGHT (c) 1989-2008.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifndef _RTEMS_SCORE_THREAD_SYNC_H
+#define _RTEMS_SCORE_THREAD_SYNC_H
+
+/**
+ * @defgroup ScoreThread Thread Blocking Operation Synchronization Handler
+ *
+ * This handler encapsulates functionality related to the management of
+ * synchronization critical sections during blocking operations.
+ */
+/**@{*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * The following enumerated types indicate what happened while the thread
+ * blocking was in the synchronization window.
+ */
+typedef enum {
+ THREAD_BLOCKING_OPERATION_SYNCHRONIZED,
+ THREAD_BLOCKING_OPERATION_NOTHING_HAPPENED,
+ THREAD_BLOCKING_OPERATION_TIMEOUT,
+ THREAD_BLOCKING_OPERATION_SATISFIED
+} Thread_blocking_operation_States;
+
+/*
+ * Operations require a thread pointer so they are prototyped
+ * in thread.h
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+/**@}*/
+
+#endif
+/* end of include file */
diff --git a/cpukit/score/include/rtems/score/tqdata.h b/cpukit/score/include/rtems/score/tqdata.h
index b70124ff9e..5b7ce98a03 100644
--- a/cpukit/score/include/rtems/score/tqdata.h
+++ b/cpukit/score/include/rtems/score/tqdata.h
@@ -6,7 +6,7 @@
*/
/*
- * COPYRIGHT (c) 1989-2006.
+ * COPYRIGHT (c) 1989-2008.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
@@ -35,6 +35,7 @@ extern "C" {
#include <rtems/score/chain.h>
#include <rtems/score/priority.h>
#include <rtems/score/states.h>
+#include <rtems/score/threadsync.h>
/**
* The following enumerated type details all of the disciplines
@@ -46,17 +47,6 @@ typedef enum {
} Thread_queue_Disciplines;
/**
- * The following enumerated types indicate what happened while the thread
- * queue was in the synchronization window.
- */
-typedef enum {
- THREAD_QUEUE_SYNCHRONIZED,
- THREAD_QUEUE_NOTHING_HAPPENED,
- THREAD_QUEUE_TIMEOUT,
- THREAD_QUEUE_SATISFIED
-} Thread_queue_States;
-
-/**
* This is one of the constants used to manage the priority queues.
*
* There are four chains used to maintain a priority -- each chain
@@ -99,7 +89,7 @@ typedef struct {
Chain_Control Priority[TASK_QUEUE_DATA_NUMBER_OF_PRIORITY_HEADERS];
} Queues;
/** This field is used to manage the critical section. */
- Thread_queue_States sync_state;
+ Thread_blocking_operation_States sync_state;
/** This field indicates the thread queue's blocking discipline. */
Thread_queue_Disciplines discipline;
/** This indicates the blocking state for threads waiting on this