summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-24 06:13:11 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-11-24 08:46:20 +0100
commit620b23ece54a0bb43189bb9c0f14adf447cbafe6 (patch)
tree10aa72eb67ac01ab85f932ac25c09ba3e5d97da8 /cpukit/posix/src
parentscore: Fix interrupt profiling (diff)
downloadrtems-620b23ece54a0bb43189bb9c0f14adf447cbafe6.tar.bz2
score: Optimize _Thread_queue_Enqueue()
Move thread state for _Thread_queue_Enqueue() to the thread queue context. This reduces the parameter count of _Thread_queue_Enqueue() from five to four (ARM for example has only four function parameter registers). Since the thread state is used after several function calls inside _Thread_queue_Enqueue() this parameter was saved on the stack previously.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r--cpukit/posix/src/condwaitsupp.c5
-rw-r--r--cpukit/posix/src/nanosleep.c5
-rw-r--r--cpukit/posix/src/sigtimedwait.c5
3 files changed, 12 insertions, 3 deletions
diff --git a/cpukit/posix/src/condwaitsupp.c b/cpukit/posix/src/condwaitsupp.c
index 9024dbf236..589b5e2810 100644
--- a/cpukit/posix/src/condwaitsupp.c
+++ b/cpukit/posix/src/condwaitsupp.c
@@ -117,6 +117,10 @@ int _POSIX_Condition_variables_Wait_support(
executing = _Thread_Executing;
if ( !already_timedout ) {
+ _Thread_queue_Context_set_thread_state(
+ &queue_context,
+ STATES_WAITING_FOR_CONDITION_VARIABLE
+ );
_Thread_queue_Context_set_enqueue_callout(
&queue_context,
_POSIX_Condition_variables_Enqueue_callout
@@ -125,7 +129,6 @@ int _POSIX_Condition_variables_Wait_support(
&the_cond->Wait_queue.Queue,
POSIX_CONDITION_VARIABLES_TQ_OPERATIONS,
executing,
- STATES_WAITING_FOR_CONDITION_VARIABLE,
&queue_context
);
error = _POSIX_Get_error_after_wait( executing );
diff --git a/cpukit/posix/src/nanosleep.c b/cpukit/posix/src/nanosleep.c
index 5deb2b8c02..10158ff44b 100644
--- a/cpukit/posix/src/nanosleep.c
+++ b/cpukit/posix/src/nanosleep.c
@@ -47,6 +47,10 @@ static inline int nanosleep_helper(
err = 0;
_Thread_queue_Context_initialize( &queue_context );
+ _Thread_queue_Context_set_thread_state(
+ &queue_context,
+ STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL
+ );
_Thread_queue_Context_set_enqueue_callout(
&queue_context,
_Thread_queue_Enqueue_do_nothing
@@ -66,7 +70,6 @@ static inline int nanosleep_helper(
&_Nanosleep_Pseudo_queue.Queue,
&_Thread_queue_Operations_FIFO,
_Thread_Executing,
- STATES_DELAYING | STATES_INTERRUPTIBLE_BY_SIGNAL,
&queue_context
);
diff --git a/cpukit/posix/src/sigtimedwait.c b/cpukit/posix/src/sigtimedwait.c
index 200d75fdf9..f96c32ef45 100644
--- a/cpukit/posix/src/sigtimedwait.c
+++ b/cpukit/posix/src/sigtimedwait.c
@@ -156,12 +156,15 @@ int sigtimedwait(
executing->Wait.option = *set;
executing->Wait.return_argument = the_info;
+ _Thread_queue_Context_set_thread_state(
+ &queue_context,
+ STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL
+ );
_Thread_queue_Context_set_do_nothing_enqueue_callout( &queue_context );
_Thread_queue_Enqueue(
&_POSIX_signals_Wait_queue.Queue,
POSIX_SIGNALS_TQ_OPERATIONS,
executing,
- STATES_WAITING_FOR_SIGNAL | STATES_INTERRUPTIBLE_BY_SIGNAL,
&queue_context
);