2002-03-01 Eric Norum <eric.norum@usask.ca>

* src/pthreadonce.c: Task is not preemptable while running a
	pthread_once init function.  This is slightly less heavy handed
	than disabling dispatching and seems better than consuming a mutex.
This commit is contained in:
Joel Sherrill
2002-03-01 17:49:57 +00:00
parent 49155d9325
commit b04ee63e3d
4 changed files with 30 additions and 14 deletions

View File

@@ -1,3 +1,9 @@
2002-03-01 Eric Norum <eric.norum@usask.ca>
* src/pthreadonce.c: Task is not preemptable while running a
pthread_once init function. This is slightly less heavy handed
than disabling dispatching and seems better than consuming a mutex.
2002-02-09 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2002-02-09 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* src/getegid.c: Add #include <rtems/userenv.h>. * src/getegid.c: Add #include <rtems/userenv.h>.

View File

@@ -18,6 +18,7 @@
#include <pthread.h> #include <pthread.h>
#include <errno.h> #include <errno.h>
#include <rtems.h>
#include <rtems/system.h> #include <rtems/system.h>
#include <rtems/score/thread.h> #include <rtems/score/thread.h>
@@ -29,15 +30,16 @@ int pthread_once(
if ( !once_control || !init_routine ) if ( !once_control || !init_routine )
return EINVAL; return EINVAL;
_Thread_Disable_dispatch(); if ( !once_control->init_executed ) {
rtems_mode saveMode;
rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode);
if ( !once_control->init_executed ) { if ( !once_control->init_executed ) {
once_control->is_initialized = TRUE; once_control->is_initialized = TRUE;
once_control->init_executed = TRUE; once_control->init_executed = TRUE;
(*init_routine)(); (*init_routine)();
} }
rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode);
_Thread_Enable_dispatch(); }
return 0; return 0;
} }

View File

@@ -1,3 +1,9 @@
2002-03-01 Eric Norum <eric.norum@usask.ca>
* src/pthreadonce.c: Task is not preemptable while running a
pthread_once init function. This is slightly less heavy handed
than disabling dispatching and seems better than consuming a mutex.
2002-02-09 Ralf Corsepius <corsepiu@faw.uni-ulm.de> 2002-02-09 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* src/getegid.c: Add #include <rtems/userenv.h>. * src/getegid.c: Add #include <rtems/userenv.h>.

View File

@@ -18,6 +18,7 @@
#include <pthread.h> #include <pthread.h>
#include <errno.h> #include <errno.h>
#include <rtems.h>
#include <rtems/system.h> #include <rtems/system.h>
#include <rtems/score/thread.h> #include <rtems/score/thread.h>
@@ -29,15 +30,16 @@ int pthread_once(
if ( !once_control || !init_routine ) if ( !once_control || !init_routine )
return EINVAL; return EINVAL;
_Thread_Disable_dispatch(); if ( !once_control->init_executed ) {
rtems_mode saveMode;
rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode);
if ( !once_control->init_executed ) { if ( !once_control->init_executed ) {
once_control->is_initialized = TRUE; once_control->is_initialized = TRUE;
once_control->init_executed = TRUE; once_control->init_executed = TRUE;
(*init_routine)(); (*init_routine)();
} }
rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode);
_Thread_Enable_dispatch(); }
return 0; return 0;
} }