This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Make generic atomicity.h use gthr.h mutexes


On Sun, Nov 10, 2002 at 03:17:54PM -0500, John David Anglin wrote:
> __initialized is local to the each inline copy of __exchange_and_add,
> so each copy will attempt to initialize _Atomic_add_mutex.  Even if
> __initialized was global, there could be race conditions in initializing
> _Atomic_add_mutex.

Yargh, of course.  Okay, if __initialized is moved to something like

  namespace __gnu_cxx
  {
    __gthread_mutex_t _Atomic_add_mutex __attribute__ ((__weak__))
  #ifdef __GTHREAD_MUTEX_INIT
                                                     = __GTHREAD_MUTEX_INIT
  #else
                                                     ;
    bool  _Atomic_add_mutex_initialized __attribute__ ((__weak__)) = false
  #endif
                                                     ;
  }

and the if branch remains, that should do it.

I'm not fond of the semicolon games played above, and will cheerfully be more
verbose if people prefer.


Phil

-- 
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
                                                 - Edsger Dijkstra, 1930-2002


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]