posix: Optimize pthread_once_t

Reduce size of pthread_once_t and make it zero-initialized.

Update #3142.
This commit is contained in:
Sebastian Huber
2017-10-05 14:29:01 +02:00
parent e46a075d35
commit 47b1e31f11
4 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -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 *))
+1 -4
View File
@@ -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 );
}
+1 -1
View File
@@ -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) );
/** @} */
+1 -1
View File
@@ -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;