summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2013-08-22 15:20:06 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2013-08-23 12:54:03 +0200
commit07332ae4db821ad8a11b1eda6fbb5b453ef069ef (patch)
tree7397f3276cc6fb06170919854c91852bc0fb75b1
parentFilesystem: Remove superfluous free() (diff)
downloadrtems-07332ae4db821ad8a11b1eda6fbb5b453ef069ef.tar.bz2
score: _Thread_queue_Enqueue_with_handler()
Add thread parameter to _Thread_queue_Enqueue_with_handler() to avoid access to global _Thread_Executing.
-rw-r--r--cpukit/posix/src/condwaitsupp.c2
-rw-r--r--cpukit/posix/src/pthreadjoin.c6
-rw-r--r--cpukit/posix/src/sigtimedwait.c2
-rw-r--r--cpukit/rtems/src/regiongetsegment.c6
-rw-r--r--cpukit/score/include/rtems/score/coresemimpl.h2
-rw-r--r--cpukit/score/include/rtems/score/threadqimpl.h11
-rw-r--r--cpukit/score/src/corebarrierwait.c2
-rw-r--r--cpukit/score/src/coremsgseize.c2
-rw-r--r--cpukit/score/src/coremsgsubmit.c6
-rw-r--r--cpukit/score/src/coremutexseize.c2
-rw-r--r--cpukit/score/src/corerwlockobtainread.c1
-rw-r--r--cpukit/score/src/corerwlockobtainwrite.c1
-rw-r--r--cpukit/score/src/coresemseize.c2
-rw-r--r--cpukit/score/src/mpci.c22
-rw-r--r--cpukit/score/src/threadqenqueue.c4
15 files changed, 46 insertions, 25 deletions
diff --git a/cpukit/posix/src/condwaitsupp.c b/cpukit/posix/src/condwaitsupp.c
index 86ad3aa6b6..a13d4f70f4 100644
--- a/cpukit/posix/src/condwaitsupp.c
+++ b/cpukit/posix/src/condwaitsupp.c
@@ -75,7 +75,7 @@ int _POSIX_Condition_variables_Wait_support(
executing->Wait.queue = &the_cond->Wait_queue;
executing->Wait.id = *cond;
- _Thread_queue_Enqueue( &the_cond->Wait_queue, timeout );
+ _Thread_queue_Enqueue( &the_cond->Wait_queue, executing, timeout );
_Objects_Put( &the_cond->Object );
diff --git a/cpukit/posix/src/pthreadjoin.c b/cpukit/posix/src/pthreadjoin.c
index f7a9d459c2..6b562ecf41 100644
--- a/cpukit/posix/src/pthreadjoin.c
+++ b/cpukit/posix/src/pthreadjoin.c
@@ -71,7 +71,11 @@ on_EINTR:
} else {
executing->Wait.return_argument = &return_pointer;
_Thread_queue_Enter_critical_section( &api->Join_List );
- _Thread_queue_Enqueue( &api->Join_List, WATCHDOG_NO_TIMEOUT );
+ _Thread_queue_Enqueue(
+ &api->Join_List,
+ executing,
+ WATCHDOG_NO_TIMEOUT
+ );
}
_Objects_Put( &the_thread->Object );
diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c
index ba24c858ea..65454ac7a3 100644
--- a/cpukit/posix/src/sigtimedwait.c
+++ b/cpukit/posix/src/sigtimedwait.c
@@ -157,7 +157,7 @@ int sigtimedwait(
executing->Wait.return_argument = the_info;
_Thread_queue_Enter_critical_section( &_POSIX_signals_Wait_queue );
_ISR_Enable( level );
- _Thread_queue_Enqueue( &_POSIX_signals_Wait_queue, interval );
+ _Thread_queue_Enqueue( &_POSIX_signals_Wait_queue, executing, interval );
_Thread_Enable_dispatch();
/*
diff --git a/cpukit/rtems/src/regiongetsegment.c b/cpukit/rtems/src/regiongetsegment.c
index 8fea5f8083..52fac445f9 100644
--- a/cpukit/rtems/src/regiongetsegment.c
+++ b/cpukit/rtems/src/regiongetsegment.c
@@ -85,7 +85,11 @@ rtems_status_code rtems_region_get_segment(
_Thread_queue_Enter_critical_section( &the_region->Wait_queue );
- _Thread_queue_Enqueue( &the_region->Wait_queue, timeout );
+ _Thread_queue_Enqueue(
+ &the_region->Wait_queue,
+ executing,
+ timeout
+ );
_Objects_Put( &the_region->Object );
diff --git a/cpukit/score/include/rtems/score/coresemimpl.h b/cpukit/score/include/rtems/score/coresemimpl.h
index 4c3c8be1b8..7f12a98670 100644
--- a/cpukit/score/include/rtems/score/coresemimpl.h
+++ b/cpukit/score/include/rtems/score/coresemimpl.h
@@ -241,7 +241,7 @@ RTEMS_INLINE_ROUTINE void _CORE_semaphore_Seize_isr_disable(
executing->Wait.id = id;
_ISR_Enable( level );
- _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
+ _Thread_queue_Enqueue( &the_semaphore->Wait_queue, executing, timeout );
_Thread_Enable_dispatch();
}
diff --git a/cpukit/score/include/rtems/score/threadqimpl.h b/cpukit/score/include/rtems/score/threadqimpl.h
index 3d801c8dff..c72982d1c3 100644
--- a/cpukit/score/include/rtems/score/threadqimpl.h
+++ b/cpukit/score/include/rtems/score/threadqimpl.h
@@ -83,9 +83,10 @@ Thread_Control *_Thread_queue_Dequeue(
* This routine enqueues the currently executing thread on
* the_thread_queue with an optional timeout.
*/
-#define _Thread_queue_Enqueue( _the_thread_queue, _timeout ) \
+#define _Thread_queue_Enqueue( _the_thread_queue, _the_thread, _timeout ) \
_Thread_queue_Enqueue_with_handler( \
_the_thread_queue, \
+ _the_thread, \
_timeout, \
_Thread_queue_Timeout )
@@ -96,15 +97,17 @@ Thread_Control *_Thread_queue_Dequeue(
* starts a timeout timer.
*
* @param[in] the_thread_queue pointer to threadq
+ * @param[in] the_thread the thread to enqueue
* @param[in] timeout interval to wait
*
* - INTERRUPT LATENCY:
* + single case
*/
void _Thread_queue_Enqueue_with_handler(
- Thread_queue_Control* the_thread_queue,
- Watchdog_Interval timeout,
- Thread_queue_Timeout_callout handler
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread,
+ Watchdog_Interval timeout,
+ Thread_queue_Timeout_callout handler
);
/**
diff --git a/cpukit/score/src/corebarrierwait.c b/cpukit/score/src/corebarrierwait.c
index aa9face886..97edf132ed 100644
--- a/cpukit/score/src/corebarrierwait.c
+++ b/cpukit/score/src/corebarrierwait.c
@@ -51,5 +51,5 @@ void _CORE_barrier_Wait(
executing->Wait.id = id;
_ISR_Enable( level );
- _Thread_queue_Enqueue( &the_barrier->Wait_queue, timeout );
+ _Thread_queue_Enqueue( &the_barrier->Wait_queue, executing, timeout );
}
diff --git a/cpukit/score/src/coremsgseize.c b/cpukit/score/src/coremsgseize.c
index b3280bf755..11d83ee2e6 100644
--- a/cpukit/score/src/coremsgseize.c
+++ b/cpukit/score/src/coremsgseize.c
@@ -121,5 +121,5 @@ void _CORE_message_queue_Seize(
/* Wait.count will be filled in with the message priority */
_ISR_Enable( level );
- _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout );
+ _Thread_queue_Enqueue( &the_message_queue->Wait_queue, executing, timeout );
}
diff --git a/cpukit/score/src/coremsgsubmit.c b/cpukit/score/src/coremsgsubmit.c
index b0b4833640..3fc4f4ccd6 100644
--- a/cpukit/score/src/coremsgsubmit.c
+++ b/cpukit/score/src/coremsgsubmit.c
@@ -130,7 +130,11 @@ CORE_message_queue_Status _CORE_message_queue_Submit(
executing->Wait.count = submit_type;
_ISR_Enable( level );
- _Thread_queue_Enqueue( &the_message_queue->Wait_queue, timeout );
+ _Thread_queue_Enqueue(
+ &the_message_queue->Wait_queue,
+ executing,
+ timeout
+ );
}
return CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_WAIT;
diff --git a/cpukit/score/src/coremutexseize.c b/cpukit/score/src/coremutexseize.c
index 2cab59e961..283029d100 100644
--- a/cpukit/score/src/coremutexseize.c
+++ b/cpukit/score/src/coremutexseize.c
@@ -65,7 +65,7 @@ void _CORE_mutex_Seize_interrupt_blocking(
}
the_mutex->blocked_count++;
- _Thread_queue_Enqueue( &the_mutex->Wait_queue, timeout );
+ _Thread_queue_Enqueue( &the_mutex->Wait_queue, executing, timeout );
_Thread_Enable_dispatch();
}
diff --git a/cpukit/score/src/corerwlockobtainread.c b/cpukit/score/src/corerwlockobtainread.c
index ca9a214627..cfba5cfbf3 100644
--- a/cpukit/score/src/corerwlockobtainread.c
+++ b/cpukit/score/src/corerwlockobtainread.c
@@ -86,6 +86,7 @@ void _CORE_RWLock_Obtain_for_reading(
_Thread_queue_Enqueue_with_handler(
&the_rwlock->Wait_queue,
+ executing,
timeout,
_CORE_RWLock_Timeout
);
diff --git a/cpukit/score/src/corerwlockobtainwrite.c b/cpukit/score/src/corerwlockobtainwrite.c
index e5f3e73029..54c41d91f3 100644
--- a/cpukit/score/src/corerwlockobtainwrite.c
+++ b/cpukit/score/src/corerwlockobtainwrite.c
@@ -76,6 +76,7 @@ void _CORE_RWLock_Obtain_for_writing(
_Thread_queue_Enqueue_with_handler(
&the_rwlock->Wait_queue,
+ executing,
timeout,
_CORE_RWLock_Timeout
);
diff --git a/cpukit/score/src/coresemseize.c b/cpukit/score/src/coresemseize.c
index cde444bfce..2cbfb47344 100644
--- a/cpukit/score/src/coresemseize.c
+++ b/cpukit/score/src/coresemseize.c
@@ -63,6 +63,6 @@ void _CORE_semaphore_Seize(
executing->Wait.queue = &the_semaphore->Wait_queue;
executing->Wait.id = id;
_ISR_Enable( level );
- _Thread_queue_Enqueue( &the_semaphore->Wait_queue, timeout );
+ _Thread_queue_Enqueue( &the_semaphore->Wait_queue, executing, timeout );
}
#endif
diff --git a/cpukit/score/src/mpci.c b/cpukit/score/src/mpci.c
index c8cf6bd70b..bc289943f3 100644
--- a/cpukit/score/src/mpci.c
+++ b/cpukit/score/src/mpci.c
@@ -190,14 +190,16 @@ uint32_t _MPCI_Send_request_packet (
States_Control extra_state
)
{
- the_packet->source_tid = _Thread_Executing->Object.id;
- the_packet->source_priority = _Thread_Executing->current_priority;
+ Thread_Control *executing = _Thread_Executing;
+
+ the_packet->source_tid = executing->Object.id;
+ the_packet->source_priority = executing->current_priority;
the_packet->to_convert =
( the_packet->to_convert - sizeof(MP_packet_Prefix) ) / sizeof(uint32_t);
- _Thread_Executing->Wait.id = the_packet->id;
+ executing->Wait.id = the_packet->id;
- _Thread_Executing->Wait.queue = &_MPCI_Remote_blocked_threads;
+ executing->Wait.queue = &_MPCI_Remote_blocked_threads;
_Thread_Disable_dispatch();
@@ -212,14 +214,18 @@ uint32_t _MPCI_Send_request_packet (
if (the_packet->timeout == MPCI_DEFAULT_TIMEOUT)
the_packet->timeout = _MPCI_table->default_timeout;
- _Thread_queue_Enqueue( &_MPCI_Remote_blocked_threads, the_packet->timeout );
+ _Thread_queue_Enqueue(
+ &_MPCI_Remote_blocked_threads,
+ executing,
+ the_packet->timeout
+ );
- _Thread_Executing->current_state =
- _States_Set( extra_state, _Thread_Executing->current_state );
+ executing->current_state =
+ _States_Set( extra_state, executing->current_state );
_Thread_Enable_dispatch();
- return _Thread_Executing->Wait.return_code;
+ return executing->Wait.return_code;
}
void _MPCI_Send_response_packet (
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 92d5546608..54f85f8075 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -28,11 +28,11 @@
void _Thread_queue_Enqueue_with_handler(
Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread,
Watchdog_Interval timeout,
Thread_queue_Timeout_callout handler
)
{
- Thread_Control *the_thread;
ISR_Level level;
Thread_blocking_operation_States sync_state;
Thread_blocking_operation_States (*enqueue_p)(
@@ -41,8 +41,6 @@ void _Thread_queue_Enqueue_with_handler(
ISR_Level *
);
- the_thread = _Thread_Executing;
-
#if defined(RTEMS_MULTIPROCESSING)
if ( _Thread_MP_Is_receive( the_thread ) && the_thread->receive_packet )
the_thread = _Thread_MP_Allocate_proxy( the_thread_queue->state );