summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpukit/posix/src/pthreadcreate.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c
index 69feb1e0c3..90e876cc84 100644
--- a/cpukit/posix/src/pthreadcreate.c
+++ b/cpukit/posix/src/pthreadcreate.c
@@ -237,6 +237,8 @@ int pthread_create(
* POSIX threads are allocated and started in one operation.
*/
+ _Thread_Disable_dispatch();
+
status = _Thread_Start(
the_thread,
THREAD_START_POINTER,
@@ -245,13 +247,6 @@ int pthread_create(
0 /* unused */
);
- if ( schedpolicy == SCHED_SPORADIC ) {
- _Watchdog_Insert_ticks(
- &api->Sporadic_timer,
- _Timespec_To_ticks( &api->schedparam.ss_replenish_period )
- );
- }
-
/*
* _Thread_Start only fails if the thread was in the incorrect state
*
@@ -260,11 +255,21 @@ int pthread_create(
*/
if ( !status ) {
+ _Thread_Enable_dispatch();
_POSIX_Threads_Free( the_thread );
_RTEMS_Unlock_allocator();
return EINVAL;
}
+ if ( schedpolicy == SCHED_SPORADIC ) {
+ _Watchdog_Insert_ticks(
+ &api->Sporadic_timer,
+ _Timespec_To_ticks( &api->schedparam.ss_replenish_period )
+ );
+ }
+
+ _Thread_Enable_dispatch();
+
/*
* Return the id and indicate we successfully created the thread
*/