summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2017-09-19 14:10:33 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2017-10-05 14:29:01 +0200
commit47b1e31f119a5830976bc16d9495d6ccb27a909a (patch)
tree5efbb7375c3627999b60c7642b24481b154b3f0e /cpukit
parentEnforce compatible Newlib version (diff)
downloadrtems-47b1e31f119a5830976bc16d9495d6ccb27a909a.tar.bz2
posix: Optimize pthread_once_t
Reduce size of pthread_once_t and make it zero-initialized. Update #3142.
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/libcsupport/src/gxx_wrappers.c2
-rw-r--r--cpukit/posix/src/pthreadonce.c5
-rw-r--r--cpukit/score/include/rtems/score/onceimpl.h2
-rw-r--r--cpukit/score/src/once.c2
4 files changed, 4 insertions, 7 deletions
diff --git a/cpukit/libcsupport/src/gxx_wrappers.c b/cpukit/libcsupport/src/gxx_wrappers.c
index d30b57037e..3a1b0f1991 100644
--- a/cpukit/libcsupport/src/gxx_wrappers.c
+++ b/cpukit/libcsupport/src/gxx_wrappers.c
@@ -46,7 +46,7 @@ int rtems_gxx_once(__gthread_once_t *once, void (*func) (void))
printk( "gxx_wrappers: once=%x, func=%x\n", *once, func );
#endif
- return _Once( once, func );
+ return _Once( (unsigned char *) once, func );
}
int rtems_gxx_key_create (__gthread_key_t *key, void (*dtor) (void *))
diff --git a/cpukit/posix/src/pthreadonce.c b/cpukit/posix/src/pthreadonce.c
index dc8a449a87..c92acf8642 100644
--- a/cpukit/posix/src/pthreadonce.c
+++ b/cpukit/posix/src/pthreadonce.c
@@ -33,8 +33,5 @@ int pthread_once(
if ( !once_control || !init_routine )
return EINVAL;
- if ( once_control->is_initialized != 1 )
- return EINVAL;
-
- return _Once( &once_control->init_executed, init_routine );
+ return _Once( &once_control->_flags, init_routine );
}
diff --git a/cpukit/score/include/rtems/score/onceimpl.h b/cpukit/score/include/rtems/score/onceimpl.h
index d81f1d0b31..21e9edade5 100644
--- a/cpukit/score/include/rtems/score/onceimpl.h
+++ b/cpukit/score/include/rtems/score/onceimpl.h
@@ -37,7 +37,7 @@ extern "C" {
* @{
*/
-int _Once( int *once_state, void (*init_routine)(void) );
+int _Once( unsigned char *once_state, void (*init_routine)(void) );
/** @} */
diff --git a/cpukit/score/src/once.c b/cpukit/score/src/once.c
index 60ae7a78c4..427659e173 100644
--- a/cpukit/score/src/once.c
+++ b/cpukit/score/src/once.c
@@ -20,7 +20,7 @@
#define ONCE_STATE_RUNNING 1
#define ONCE_STATE_COMPLETE 2
-int _Once( int *once_state, void ( *init_routine )( void ) )
+int _Once( unsigned char *once_state, void ( *init_routine )( void ) )
{
int eno = 0;