Changeset 49155d9 in rtems


Ignore:
Timestamp:
Mar 1, 2002, 5:45:33 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
b04ee63
Parents:
41debfd
Message:

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

  • 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.
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/libcsupport/src/gxx_wrappers.c

    r41debfd r49155d9  
    6464   printk( "gxx_wrappers: once=%x, func=%x\n", *once, func );
    6565#endif
    66    if( *once == 0 )
     66   if( *(volatile __gthread_once_t *)once == 0 )
    6767   {
    68       /*
    69        * NOTE: could not use the call to disable "preemption", it causes
    70        * one exception. Somebody might want to investiage it further
    71        * sometime later.
    72        */
    73       _Thread_Disable_dispatch();
    74       *once = 1;
    75       (*func)();
    76       _Thread_Enable_dispatch();
     68      rtems_mode saveMode;
     69      rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode);
     70      if( *(volatile __gthread_once_t *)once == 0 )
     71      {
     72         *(volatile __gthread_once_t *)once = 1;
     73         (*func)();
     74      }
     75      rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode);
    7776   }
    7877   return 0;
  • c/src/lib/ChangeLog

    r41debfd r49155d9  
     12002-03-01      Eric Norum <eric.norum@usask.ca>
     2
     3        * libc/gxx_wrappers.c: Task is not preemptable while running a
     4        pthread_once init function.  This is slightly less heavy handed
     5        than disabling dispatching and seems better than consuming a mutex.
     6
    172001-01-31      Mike Siers <mikes@poliac.com>
    28
  • c/src/lib/libc/gxx_wrappers.c

    r41debfd r49155d9  
    6464   printk( "gxx_wrappers: once=%x, func=%x\n", *once, func );
    6565#endif
    66    if( *once == 0 )
     66   if( *(volatile __gthread_once_t *)once == 0 )
    6767   {
    68       /*
    69        * NOTE: could not use the call to disable "preemption", it causes
    70        * one exception. Somebody might want to investiage it further
    71        * sometime later.
    72        */
    73       _Thread_Disable_dispatch();
    74       *once = 1;
    75       (*func)();
    76       _Thread_Enable_dispatch();
     68      rtems_mode saveMode;
     69      rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode);
     70      if( *(volatile __gthread_once_t *)once == 0 )
     71      {
     72         *(volatile __gthread_once_t *)once = 1;
     73         (*func)();
     74      }
     75      rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode);
    7776   }
    7877   return 0;
  • cpukit/libcsupport/src/gxx_wrappers.c

    r41debfd r49155d9  
    6464   printk( "gxx_wrappers: once=%x, func=%x\n", *once, func );
    6565#endif
    66    if( *once == 0 )
     66   if( *(volatile __gthread_once_t *)once == 0 )
    6767   {
    68       /*
    69        * NOTE: could not use the call to disable "preemption", it causes
    70        * one exception. Somebody might want to investiage it further
    71        * sometime later.
    72        */
    73       _Thread_Disable_dispatch();
    74       *once = 1;
    75       (*func)();
    76       _Thread_Enable_dispatch();
     68      rtems_mode saveMode;
     69      rtems_task_mode(RTEMS_NO_PREEMPT, RTEMS_PREEMPT_MASK, &saveMode);
     70      if( *(volatile __gthread_once_t *)once == 0 )
     71      {
     72         *(volatile __gthread_once_t *)once = 1;
     73         (*func)();
     74      }
     75      rtems_task_mode(saveMode, RTEMS_PREEMPT_MASK, &saveMode);
    7776   }
    7877   return 0;
Note: See TracChangeset for help on using the changeset viewer.