mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 20:33:51 +08:00
posix: Optimize pthread_once_t
Reduce size of pthread_once_t and make it zero-initialized. Update #3142.
This commit is contained in:
@@ -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 *))
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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) );
|
||||
|
||||
/** @} */
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user