summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2006-11-15 14:08:49 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2006-11-15 14:08:49 +0000
commit047d67ab257600533bc3a1047a2a54d287dcc2d2 (patch)
tree1fc509d0e86d7998aa162912bb9c3d01a7606fed /cpukit/score
parentRegenerate. (diff)
downloadrtems-047d67ab257600533bc3a1047a2a54d287dcc2d2.tar.bz2
2006-11-15 Joel Sherrill <joel.sherrill@oarcorp.com>
* libcsupport/src/termios.c, posix/Makefile.am, posix/preinstall.am, posix/include/rtems/posix/config.h, posix/include/rtems/posix/time.h, sapi/src/posixapi.c, score/Makefile.am, score/preinstall.am, score/include/rtems/score/corerwlock.h, score/include/rtems/score/threadq.h, score/src/corerwlockobtainread.c, score/src/threadqenqueue.c, score/src/threadqtimeout.c: Adding POSIX barriers, POSIX spinlocks, and partial implementation of POSIX rwlocks. * posix/include/rtems/posix/barrier.h, posix/include/rtems/posix/rwlock.h, posix/include/rtems/posix/spinlock.h, posix/inline/rtems/posix/barrier.inl, posix/inline/rtems/posix/rwlock.inl, posix/inline/rtems/posix/spinlock.inl, posix/src/barrierattrdestroy.c, posix/src/barrierattrgetpshared.c, posix/src/barrierattrinit.c, posix/src/barrierattrsetpshared.c, posix/src/pbarrier.c, posix/src/pbarrierdestroy.c, posix/src/pbarrierinit.c, posix/src/pbarriertranslatereturncode.c, posix/src/pbarrierwait.c, posix/src/prwlock.c, posix/src/prwlockdestroy.c, posix/src/prwlockinit.c, posix/src/prwlockrdlock.c, posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c, posix/src/prwlocktranslatereturncode.c, posix/src/prwlocktryrdlock.c, posix/src/prwlocktrywrlock.c, posix/src/prwlockunlock.c, posix/src/prwlockwrlock.c, posix/src/pspin.c, posix/src/pspindestroy.c, posix/src/pspininit.c, posix/src/pspinlock.c, posix/src/pspinlocktranslatereturncode.c, posix/src/pspintrylock.c, posix/src/pspinunlock.c, posix/src/rwlockattrdestroy.c, posix/src/rwlockattrgetpshared.c, posix/src/rwlockattrinit.c, posix/src/rwlockattrsetpshared.c: New files.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/Makefile.am8
-rw-r--r--cpukit/score/include/rtems/score/corerwlock.h16
-rw-r--r--cpukit/score/include/rtems/score/threadq.h36
-rw-r--r--cpukit/score/preinstall.am4
-rw-r--r--cpukit/score/src/corerwlockobtainread.c6
-rw-r--r--cpukit/score/src/threadqenqueue.c11
-rw-r--r--cpukit/score/src/threadqtimeout.c27
7 files changed, 69 insertions, 39 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 068ccd2595..bd70042512 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -50,9 +50,9 @@ include_rtems_score_HEADERS += inline/rtems/score/address.inl \
inline/rtems/score/object.inl inline/rtems/score/priority.inl \
inline/rtems/score/stack.inl inline/rtems/score/states.inl \
inline/rtems/score/sysstate.inl inline/rtems/score/thread.inl \
- inline/rtems/score/tod.inl inline/rtems/score/tqdata.inl \
- inline/rtems/score/userext.inl inline/rtems/score/watchdog.inl \
- inline/rtems/score/wkspace.inl
+ inline/rtems/score/threadq.inl inline/rtems/score/tod.inl \
+ inline/rtems/score/tqdata.inl inline/rtems/score/userext.inl \
+ inline/rtems/score/watchdog.inl inline/rtems/score/wkspace.inl
if HAS_MP
## We only build multiprocessing related files if HAS_MP was defined
@@ -91,7 +91,7 @@ libscore_a_SOURCES += src/coremutex.c src/coremutexflush.c \
## CORE_RWLOCK_C_FILES
libscore_a_SOURCES += src/corerwlock.c src/corerwlockobtainread.c \
- src/corerwlockobtainwrite.c src/corerwlockrelease.c
+ src/corerwlockobtainwrite.c src/corerwlockrelease.c src/corerwlocktimeout.c
## CORE_SEMAPHORE_C_FILES
libscore_a_SOURCES += src/coresem.c src/coresemflush.c src/coresemseize.c \
diff --git a/cpukit/score/include/rtems/score/corerwlock.h b/cpukit/score/include/rtems/score/corerwlock.h
index d596ac4130..60c966529b 100644
--- a/cpukit/score/include/rtems/score/corerwlock.h
+++ b/cpukit/score/include/rtems/score/corerwlock.h
@@ -205,6 +205,22 @@ CORE_RWLock_Status _CORE_RWLock_Release(
(_status) \
)
+/**
+ * @brief RWLock Specific Thread Queue Timeout
+ *
+ * This routine processes a thread which timeouts while waiting on
+ * an RWLock's thread queue. It is called by the watchdog handler.
+ *
+ * @param[in] id is the Id of thread to timeout
+ * @param[in] ignored is an unused pointer to a caller defined area
+ */
+
+void _CORE_RWLock_Timeout(
+ Objects_Id id,
+ void *ignored
+);
+
+
#ifndef __RTEMS_APPLICATION__
#include <rtems/score/corerwlock.inl>
#endif
diff --git a/cpukit/score/include/rtems/score/threadq.h b/cpukit/score/include/rtems/score/threadq.h
index 51ac3377ba..8744887344 100644
--- a/cpukit/score/include/rtems/score/threadq.h
+++ b/cpukit/score/include/rtems/score/threadq.h
@@ -47,7 +47,17 @@ extern "C" {
* is extracted from a local thread queue.
*/
typedef void ( *Thread_queue_Flush_callout )(
- Thread_Control *
+ Thread_Control *
+ );
+
+/**
+ *
+ * The following type defines the callout used for timeout processing
+ * methods.
+ */
+typedef void ( *Thread_queue_Timeout_callout )(
+ Objects_Id,
+ void *
);
/** @brief Thread queue Dequeue
@@ -61,14 +71,27 @@ Thread_Control *_Thread_queue_Dequeue(
Thread_queue_Control *the_thread_queue
);
+/** @brief Thread queue Enqueue Wrapper
+ *
+ * This routine enqueues the currently executing thread on
+ * the_thread_queue with an optional timeout.
+ */
+#define _Thread_queue_Enqueue( _the_thread_queue, _timeout ) \
+ _Thread_queue_Enqueue_with_handler( \
+ _the_thread_queue, \
+ _timeout, \
+ _Thread_queue_Timeout )
+
+
/** @brief Thread queue Enqueue
*
* This routine enqueues the currently executing thread on
* the_thread_queue with an optional timeout.
*/
-void _Thread_queue_Enqueue(
- Thread_queue_Control *the_thread_queue,
- Watchdog_Interval timeout
+void _Thread_queue_Enqueue_with_handler(
+ Thread_queue_Control* the_thread_queue,
+ Watchdog_Interval timeout,
+ Thread_queue_Timeout_callout handler
);
/** @brief Thread queue Extract
@@ -220,6 +243,11 @@ void _Thread_queue_Timeout (
void *ignored
);
+
+#ifndef __RTEMS_APPLICATION__
+#include <rtems/score/threadq.inl>
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/score/preinstall.am b/cpukit/score/preinstall.am
index 4ce5dc3794..d1709fca0a 100644
--- a/cpukit/score/preinstall.am
+++ b/cpukit/score/preinstall.am
@@ -232,6 +232,10 @@ $(PROJECT_INCLUDE)/rtems/score/thread.inl: inline/rtems/score/thread.inl $(PROJE
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/thread.inl
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/thread.inl
+$(PROJECT_INCLUDE)/rtems/score/threadq.inl: inline/rtems/score/threadq.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/threadq.inl
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/threadq.inl
+
$(PROJECT_INCLUDE)/rtems/score/tod.inl: inline/rtems/score/tod.inl $(PROJECT_INCLUDE)/rtems/score/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/score/tod.inl
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/score/tod.inl
diff --git a/cpukit/score/src/corerwlockobtainread.c b/cpukit/score/src/corerwlockobtainread.c
index c90bf02f07..46f77043e8 100644
--- a/cpukit/score/src/corerwlockobtainread.c
+++ b/cpukit/score/src/corerwlockobtainread.c
@@ -97,7 +97,11 @@ void _CORE_RWLock_Obtain_for_reading(
executing->Wait.return_code = CORE_RWLOCK_SUCCESSFUL;
_ISR_Enable( level );
- _Thread_queue_Enqueue( &the_rwlock->Wait_queue, timeout );
+ _Thread_queue_Enqueue_with_handler(
+ &the_rwlock->Wait_queue,
+ timeout,
+ _CORE_RWLock_Timeout
+ );
/* return to API level so it can dispatch and we block */
}
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 848b256b53..3cbf76800b 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -30,7 +30,7 @@
/*PAGE
*
- * _Thread_queue_Enqueue
+ * _Thread_queue_Enqueue_with_handler
*
* This routine blocks a thread, places it on a thread, and optionally
* starts a timeout timer.
@@ -45,9 +45,10 @@
* only case
*/
-void _Thread_queue_Enqueue(
- Thread_queue_Control *the_thread_queue,
- Watchdog_Interval timeout
+void _Thread_queue_Enqueue_with_handler(
+ Thread_queue_Control *the_thread_queue,
+ Watchdog_Interval timeout,
+ Thread_queue_Timeout_callout handler
)
{
Thread_Control *the_thread;
@@ -64,7 +65,7 @@ void _Thread_queue_Enqueue(
if ( timeout ) {
_Watchdog_Initialize(
&the_thread->Timer,
- _Thread_queue_Timeout,
+ handler,
the_thread->Object.id,
NULL
);
diff --git a/cpukit/score/src/threadqtimeout.c b/cpukit/score/src/threadqtimeout.c
index 8913aa123a..1a135482f1 100644
--- a/cpukit/score/src/threadqtimeout.c
+++ b/cpukit/score/src/threadqtimeout.c
@@ -25,8 +25,7 @@
#include <rtems/score/threadq.h>
#include <rtems/score/tqdata.h>
-/*PAGE
- *
+/*
* _Thread_queue_Timeout
*
* This routine processes a thread which timeouts while waiting on
@@ -44,7 +43,6 @@ void _Thread_queue_Timeout(
)
{
Thread_Control *the_thread;
- Thread_queue_Control *the_thread_queue;
Objects_Locations location;
the_thread = _Thread_Get( id, &location );
@@ -53,28 +51,7 @@ void _Thread_queue_Timeout(
case OBJECTS_REMOTE: /* impossible */
break;
case OBJECTS_LOCAL:
- the_thread_queue = the_thread->Wait.queue;
-
- /*
- * If the_thread_queue is not synchronized, then it is either
- * "nothing happened", "timeout", or "satisfied". If the_thread
- * is the executing thread, then it is in the process of blocking
- * and it is the thread which is responsible for the synchronization
- * process.
- *
- * If it is not satisfied, then it is "nothing happened" and
- * this is the "timeout" transition. After a request is satisfied,
- * a timeout is not allowed to occur.
- */
-
- if ( the_thread_queue->sync_state != THREAD_QUEUE_SYNCHRONIZED &&
- _Thread_Is_executing( the_thread ) ) {
- if ( the_thread_queue->sync_state != THREAD_QUEUE_SATISFIED )
- the_thread_queue->sync_state = THREAD_QUEUE_TIMEOUT;
- } else {
- the_thread->Wait.return_code = the_thread->Wait.queue->timeout_status;
- _Thread_queue_Extract( the_thread->Wait.queue, the_thread );
- }
+ _Thread_queue_Process_timeout( the_thread );
_Thread_Unnest_dispatch();
break;
}