summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--c/src/exec/posix/src/time.c5
-rw-r--r--c/src/exec/rtems/src/tasks.c13
-rw-r--r--cpukit/posix/src/time.c5
-rw-r--r--cpukit/rtems/src/tasks.c13
4 files changed, 18 insertions, 18 deletions
diff --git a/c/src/exec/posix/src/time.c b/c/src/exec/posix/src/time.c
index a14eb71f8e..b4367fac4c 100644
--- a/c/src/exec/posix/src/time.c
+++ b/c/src/exec/posix/src/time.c
@@ -314,8 +314,9 @@ int nanosleep(
*/
if ( !ticks ) {
- _Thread_Yield_processor();
- _Thread_Dispatch();
+ _Thread_Disable_dispatch();
+ _Thread_Yield_processor();
+ _Thread_Enable_dispatch();
if ( rmtp ) {
rmtp->tv_sec = 0;
rmtp->tv_nsec = 0;
diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c
index 5f6c8366c4..0f3596c800 100644
--- a/c/src/exec/rtems/src/tasks.c
+++ b/c/src/exec/rtems/src/tasks.c
@@ -1055,11 +1055,10 @@ rtems_status_code rtems_task_wake_after(
rtems_interval ticks
)
{
- if ( ticks == 0 ) {
- _Thread_Yield_processor();
- _Thread_Dispatch();
- } else {
- _Thread_Disable_dispatch();
+ _Thread_Disable_dispatch();
+ if ( ticks == 0 ) {
+ _Thread_Yield_processor();
+ } else {
_Thread_Set_state( _Thread_Executing, STATES_DELAYING );
_Watchdog_Initialize(
&_Thread_Executing->Timer,
@@ -1068,8 +1067,8 @@ rtems_status_code rtems_task_wake_after(
NULL
);
_Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
- _Thread_Enable_dispatch();
- }
+ }
+ _Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
}
diff --git a/cpukit/posix/src/time.c b/cpukit/posix/src/time.c
index a14eb71f8e..b4367fac4c 100644
--- a/cpukit/posix/src/time.c
+++ b/cpukit/posix/src/time.c
@@ -314,8 +314,9 @@ int nanosleep(
*/
if ( !ticks ) {
- _Thread_Yield_processor();
- _Thread_Dispatch();
+ _Thread_Disable_dispatch();
+ _Thread_Yield_processor();
+ _Thread_Enable_dispatch();
if ( rmtp ) {
rmtp->tv_sec = 0;
rmtp->tv_nsec = 0;
diff --git a/cpukit/rtems/src/tasks.c b/cpukit/rtems/src/tasks.c
index 5f6c8366c4..0f3596c800 100644
--- a/cpukit/rtems/src/tasks.c
+++ b/cpukit/rtems/src/tasks.c
@@ -1055,11 +1055,10 @@ rtems_status_code rtems_task_wake_after(
rtems_interval ticks
)
{
- if ( ticks == 0 ) {
- _Thread_Yield_processor();
- _Thread_Dispatch();
- } else {
- _Thread_Disable_dispatch();
+ _Thread_Disable_dispatch();
+ if ( ticks == 0 ) {
+ _Thread_Yield_processor();
+ } else {
_Thread_Set_state( _Thread_Executing, STATES_DELAYING );
_Watchdog_Initialize(
&_Thread_Executing->Timer,
@@ -1068,8 +1067,8 @@ rtems_status_code rtems_task_wake_after(
NULL
);
_Watchdog_Insert_ticks( &_Thread_Executing->Timer, ticks );
- _Thread_Enable_dispatch();
- }
+ }
+ _Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;
}