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/itron | |
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/itron')
-rw-r--r-- | cpukit/itron/include/rtems/itron/task.h | 6 | ||||
-rw-r--r-- | cpukit/itron/src/cre_tsk.c | 20 |
2 files changed, 16 insertions, 10 deletions
diff --git a/cpukit/itron/include/rtems/itron/task.h b/cpukit/itron/include/rtems/itron/task.h index e7ad311b29..e136c5719f 100644 --- a/cpukit/itron/include/rtems/itron/task.h +++ b/cpukit/itron/include/rtems/itron/task.h @@ -3,7 +3,7 @@ */ /* - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -84,7 +84,9 @@ ER _ITRON_Delete_task( Thread_Control *the_thread ); -/* XXX remove the need for this. Enable dispatch should not be hidden */ +/* + * Return a status code and enable dispatching + */ #define _ITRON_return_errorno( _errno ) \ do { \ diff --git a/cpukit/itron/src/cre_tsk.c b/cpukit/itron/src/cre_tsk.c index 5ae87c1675..6c2047303a 100644 --- a/cpukit/itron/src/cre_tsk.c +++ b/cpukit/itron/src/cre_tsk.c @@ -1,5 +1,5 @@ /* - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -20,6 +20,7 @@ #include <rtems/score/wkspace.h> #include <rtems/score/apiext.h> #include <rtems/score/sysstate.h> +#include <rtems/score/apimutex.h> #include <rtems/itron/task.h> @@ -65,18 +66,19 @@ ER cre_tsk( return E_PAR; /* - * Disable dispatching. + * Lock the allocator mutex for protection */ - - _Thread_Disable_dispatch(); + _RTEMS_Lock_allocator(); /* * allocate the thread. */ the_thread = _ITRON_Task_Allocate( tskid ); - if ( !the_thread ) - _ITRON_return_errorno( _ITRON_Task_Clarify_allocation_id_error( tskid ) ); + if ( !the_thread ) { + _RTEMS_Unlock_allocator(); + return _ITRON_Task_Clarify_allocation_id_error( tskid ); + } /* * Initialize the core thread for this task. @@ -104,7 +106,8 @@ ER cre_tsk( if ( !status ) { _ITRON_Task_Free( the_thread ); - _ITRON_return_errorno( E_NOMEM ); + _RTEMS_Unlock_allocator(); + return E_NOMEM; } /* @@ -118,5 +121,6 @@ ER cre_tsk( the_thread->Start.entry_point = (Thread_Entry) pk_ctsk->task; - _ITRON_return_errorno( E_OK ); + _RTEMS_Unlock_allocator(); + return E_OK; } |