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

* libc/gxx_wrappers.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:45:33 +00:00
parent 41debfd2ef
commit 49155d9325
4 changed files with 33 additions and 30 deletions

View File

@@ -63,17 +63,16 @@ int rtems_gxx_once(__gthread_once_t *once, void (*func) ())
#ifdef DEBUG_GXX_WRAPPERS
printk( "gxx_wrappers: once=%x, func=%x\n", *once, func );
#endif
if( *once == 0 )
if( *(volatile __gthread_once_t *)once == 0 )
{
/*
* NOTE: could not use the call to disable "preemption", it causes
* one exception. Somebody might want to investiage it further
* sometime later.
*/
_Thread_Disable_dispatch();
*once = 1;
(*func)();
_Thread_Enable_dispatch();
rtems_mode saveMode;
rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode);
if( *(volatile __gthread_once_t *)once == 0 )
{
*(volatile __gthread_once_t *)once = 1;
(*func)();
}
rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode);
}
return 0;
}

View File

@@ -1,3 +1,9 @@
2002-03-01 Eric Norum <eric.norum@usask.ca>
* libc/gxx_wrappers.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.
2001-01-31 Mike Siers <mikes@poliac.com>
* Nice Update of PPPD support which eliminates the

View File

@@ -63,17 +63,16 @@ int rtems_gxx_once(__gthread_once_t *once, void (*func) ())
#ifdef DEBUG_GXX_WRAPPERS
printk( "gxx_wrappers: once=%x, func=%x\n", *once, func );
#endif
if( *once == 0 )
if( *(volatile __gthread_once_t *)once == 0 )
{
/*
* NOTE: could not use the call to disable "preemption", it causes
* one exception. Somebody might want to investiage it further
* sometime later.
*/
_Thread_Disable_dispatch();
*once = 1;
(*func)();
_Thread_Enable_dispatch();
rtems_mode saveMode;
rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode);
if( *(volatile __gthread_once_t *)once == 0 )
{
*(volatile __gthread_once_t *)once = 1;
(*func)();
}
rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode);
}
return 0;
}

View File

@@ -63,17 +63,16 @@ int rtems_gxx_once(__gthread_once_t *once, void (*func) ())
#ifdef DEBUG_GXX_WRAPPERS
printk( "gxx_wrappers: once=%x, func=%x\n", *once, func );
#endif
if( *once == 0 )
if( *(volatile __gthread_once_t *)once == 0 )
{
/*
* NOTE: could not use the call to disable "preemption", it causes
* one exception. Somebody might want to investiage it further
* sometime later.
*/
_Thread_Disable_dispatch();
*once = 1;
(*func)();
_Thread_Enable_dispatch();
rtems_mode saveMode;
rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode);
if( *(volatile __gthread_once_t *)once == 0 )
{
*(volatile __gthread_once_t *)once = 1;
(*func)();
}
rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode);
}
return 0;
}