summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-04-22 10:06:05 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-19 12:00:45 +0200
commit08fe84b5d7072b7809581b1a25954a3b221497a5 (patch)
tree79a1ea39b1ea24ca25bf9f450a726efe80dd6257 /cpukit/rtems
parentscore: Reduce thread wait states (diff)
downloadrtems-08fe84b5d7072b7809581b1a25954a3b221497a5.tar.bz2
score: Generalize _Event_Timeout()
Add a thread wait timeout code. Replace _Event_Timeout() with a general purpose _Thread_Timeout() watchdog handler. Update #2273.
Diffstat (limited to 'cpukit/rtems')
-rw-r--r--cpukit/rtems/Makefile.am1
-rw-r--r--cpukit/rtems/src/eventseize.c8
-rw-r--r--cpukit/rtems/src/eventtimeout.c70
3 files changed, 7 insertions, 72 deletions
diff --git a/cpukit/rtems/Makefile.am b/cpukit/rtems/Makefile.am
index 5e6f2eafa0..084b39f8b3 100644
--- a/cpukit/rtems/Makefile.am
+++ b/cpukit/rtems/Makefile.am
@@ -210,7 +210,6 @@ librtems_a_SOURCES += src/eventreceive.c
librtems_a_SOURCES += src/eventseize.c
librtems_a_SOURCES += src/eventsend.c
librtems_a_SOURCES += src/eventsurrender.c
-librtems_a_SOURCES += src/eventtimeout.c
librtems_a_SOURCES += src/systemeventsend.c
librtems_a_SOURCES += src/systemeventreceive.c
diff --git a/cpukit/rtems/src/eventseize.c b/cpukit/rtems/src/eventseize.c
index 36b1964820..6611a8d6f6 100644
--- a/cpukit/rtems/src/eventseize.c
+++ b/cpukit/rtems/src/eventseize.c
@@ -89,7 +89,13 @@ void _Event_Seize(
_Giant_Acquire( cpu_self );
if ( ticks ) {
- _Watchdog_Initialize( &executing->Timer, _Event_Timeout, 0, executing );
+ _Thread_Wait_set_timeout_code( executing, RTEMS_TIMEOUT );
+ _Watchdog_Initialize(
+ &executing->Timer,
+ _Thread_Timeout,
+ 0,
+ executing
+ );
_Watchdog_Insert_ticks( &executing->Timer, ticks );
}
diff --git a/cpukit/rtems/src/eventtimeout.c b/cpukit/rtems/src/eventtimeout.c
deleted file mode 100644
index 5db118b183..0000000000
--- a/cpukit/rtems/src/eventtimeout.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * @file
- *
- * @brief Timeout Event
- * @ingroup ClassicEvent
- */
-
-/*
- * 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.org/license/LICENSE.
- */
-
-#if HAVE_CONFIG_H
- #include "config.h"
-#endif
-
-#include <rtems/rtems/eventimpl.h>
-#include <rtems/score/threadimpl.h>
-
-void _Event_Timeout(
- Objects_Id id,
- void *arg
-)
-{
- Thread_Control *the_thread;
- ISR_lock_Context lock_context;
- Thread_Wait_flags wait_flags;
- Thread_Wait_flags wait_class;
- Thread_Wait_flags intend_to_block;
- Thread_Wait_flags blocked;
- bool success;
- bool unblock;
-
- the_thread = arg;
- _Thread_Lock_acquire_default( the_thread, &lock_context );
-
- wait_flags = _Thread_Wait_flags_get( the_thread );
- wait_class = wait_flags & THREAD_WAIT_CLASS_MASK;
- intend_to_block = wait_class | THREAD_WAIT_STATE_INTEND_TO_BLOCK;
- blocked = wait_class | THREAD_WAIT_STATE_BLOCKED;
- success = _Thread_Wait_flags_try_change_critical(
- the_thread,
- intend_to_block,
- wait_class | THREAD_WAIT_STATE_READY_AGAIN
- );
-
- if ( success ) {
- the_thread->Wait.return_code = RTEMS_TIMEOUT;
- unblock = false;
- } else if ( _Thread_Wait_flags_get( the_thread ) == blocked ) {
- the_thread->Wait.return_code = RTEMS_TIMEOUT;
- _Thread_Wait_flags_set(
- the_thread,
- wait_class | THREAD_WAIT_STATE_READY_AGAIN
- );
- unblock = true;
- } else {
- unblock = false;
- }
-
- _Thread_Lock_release_default( the_thread, &lock_context );
-
- if ( unblock ) {
- _Thread_Unblock( the_thread );
- }
-}