summaryrefslogtreecommitdiffstats
path: root/c/src/exec/posix
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2002-03-01 17:49:57 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2002-03-01 17:49:57 +0000
commitb04ee63e3d855aab7fe2a84377bdff6674417e51 (patch)
treefc9bed24402a18d7fc793ee9cf2833afab603023 /c/src/exec/posix
parent2002-03-01 Eric Norum <eric.norum@usask.ca> (diff)
downloadrtems-b04ee63e3d855aab7fe2a84377bdff6674417e51.tar.bz2
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.
Diffstat (limited to 'c/src/exec/posix')
-rw-r--r--c/src/exec/posix/ChangeLog6
-rw-r--r--c/src/exec/posix/src/pthreadonce.c16
2 files changed, 15 insertions, 7 deletions
diff --git a/c/src/exec/posix/ChangeLog b/c/src/exec/posix/ChangeLog
index ff7f08e46e..82b7305b22 100644
--- a/c/src/exec/posix/ChangeLog
+++ b/c/src/exec/posix/ChangeLog
@@ -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>
* src/getegid.c: Add #include <rtems/userenv.h>.
diff --git a/c/src/exec/posix/src/pthreadonce.c b/c/src/exec/posix/src/pthreadonce.c
index 6026dfe7c0..94cbb005da 100644
--- a/c/src/exec/posix/src/pthreadonce.c
+++ b/c/src/exec/posix/src/pthreadonce.c
@@ -18,6 +18,7 @@
#include <pthread.h>
#include <errno.h>
+#include <rtems.h>
#include <rtems/system.h>
#include <rtems/score/thread.h>
@@ -29,15 +30,16 @@ int pthread_once(
if ( !once_control || !init_routine )
return EINVAL;
- _Thread_Disable_dispatch();
-
if ( !once_control->init_executed ) {
- once_control->is_initialized = TRUE;
- once_control->init_executed = TRUE;
- (*init_routine)();
+ rtems_mode saveMode;
+ rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode);
+ if ( !once_control->init_executed ) {
+ once_control->is_initialized = TRUE;
+ once_control->init_executed = TRUE;
+ (*init_routine)();
+ }
+ rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode);
}
-
- _Thread_Enable_dispatch();
return 0;
}