diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-02-28 16:15:35 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2008-02-28 16:15:35 +0000 |
commit | 5088d978385ce6d28db1731aab57b23ca1f6e9cc (patch) | |
tree | 2e061c7ff3c5287ac53f2945421425209cb2c33e /cpukit/posix | |
parent | 2008-02-28 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-5088d978385ce6d28db1731aab57b23ca1f6e9cc.tar.bz2 |
2008-02-28 Joel Sherrill <joel.sherrill@oarcorp.com>
* itron/include/rtems/itron/task.h, itron/src/cre_tsk.c,
posix/src/pthreadcreate.c, rtems/src/taskcreate.c,
rtems/src/taskdelete.c, rtems/src/timerserver.c,
score/src/threadclose.c, score/src/threadcreateidle.c,
score/src/threadinitialize.c: Switch task create and delete
operations to using API Allocator Mutex. This moves almost all uses
of the RTEMS Workspace from dispatching disabled to mutex protected
which should improve deterministic behavior. The implementation was
carefully done to allow task create and delete extensions to invoke
more services. In particular, a task delete extension should be able
to do mutex and file operations.
Diffstat (limited to 'cpukit/posix')
-rw-r--r-- | cpukit/posix/src/pthreadcreate.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/cpukit/posix/src/pthreadcreate.c b/cpukit/posix/src/pthreadcreate.c index e6bd5bc549..6eeda2da14 100644 --- a/cpukit/posix/src/pthreadcreate.c +++ b/cpukit/posix/src/pthreadcreate.c @@ -2,7 +2,7 @@ * 16.1.2 Thread Creation, P1003.1c/Draft 10, p. 144 */ -/* COPYRIGHT (c) 1989-2007. +/* COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -24,6 +24,7 @@ #include <rtems/posix/pthread.h> #include <rtems/posix/priority.h> #include <rtems/posix/time.h> +#include <rtems/score/apimutex.h> int pthread_create( pthread_t *thread, @@ -157,10 +158,9 @@ int pthread_create( #endif /* - * Disable dispatch for protection + * Lock the allocator mutex for protection */ - - _Thread_Disable_dispatch(); + _RTEMS_Lock_allocator(); /* * Allocate the thread control block. @@ -171,7 +171,7 @@ int pthread_create( the_thread = _POSIX_Threads_Allocate(); if ( !the_thread ) { - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return EAGAIN; } @@ -196,7 +196,7 @@ int pthread_create( if ( !status ) { _POSIX_Threads_Free( the_thread ); - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return EAGAIN; } @@ -249,7 +249,7 @@ int pthread_create( if ( !status ) { _POSIX_Threads_Free( the_thread ); - _Thread_Enable_dispatch(); + _RTEMS_Unlock_allocator(); return EINVAL; } @@ -259,7 +259,6 @@ int pthread_create( *thread = the_thread->Object.id; - _Thread_Enable_dispatch(); - - return 0; + _RTEMS_Unlock_allocator(); + return 0; } |