On Mon, 2009-02-23 at 08:08 -0800, Michał Król wrote: > Brian Paul pisze: > > José Fonseca wrote: > > > >> OneTimeLock protects one time initializations and is instantiated with > >> _glthread_DECLARE_STATIC_MUTEX, an used without ever calling > >> _glthread_INIT_MUTEX or _glthread_DESTROY_MUTEX. > >> > >> This is non portable, especially on Windows, where locks must be > >> initialized before using, so it ends up defining > >> _glthread_DECLARE_STATIC_MUTEX without the static keyword in order to > >> initialize it from somewhere else. ugh > >> > >> And if the OneTimeLock has to be initialized one time before it is used > >> there is not much point for it to exist in the first place. > >> > >> Is there any reason to not simply have an one time Mesa initialization > >> function, which must be called before creating a Mesa context? > >> > >> If a Mesa driver does not have a single initialization point, then let > >> it create its own lock to protect the call of this mesa one time > >> initialization function. > >> > > > > Actually, if you want to remove OneTimeLock entirely, I don't think it'd > > be a problem. I don't think there's anything in one_time_init() that > > would fail if two threads called it at the same time. > > > > > And if you *do* want to keep OneTimeLock in place, there is a way on > Windows to implement it with STATIC_MUTEX semantics. > > You need this: > http://msdn.microsoft.com/en-us/library/ms683560(VS.85).aspx
Brian, Michal, thanks for the info. I'll drop OneTimeLock. There is one other _glthread_DECLARE_STATIC_MUTEX usage: exec_mutex in execmain.c. But I don't think this is used in Gallium (it was not being initialized, and it didn't cause a problem in Windows yet). Jose ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev