On Fri, Jul 10, 2009 at 12:01:06PM -0700, Ian Romanick wrote:
> >  _glthread_DECLARE_STATIC_MUTEX(ThreadCheckMutex);
> > -static GLboolean ThreadSafe = GL_FALSE;  /**< In thread-safe mode? */
> > +GLboolean _glapi_ThreadSafe = GL_FALSE;  /**< In thread-safe mode? */
> I've never been a fan of this variable name.  Unless Brian objects, I'd
> like to see this changed to _glapi_SingleThreaded or something similar.
>  That makes the real meaning a bit more clear, I think.  Also, shouldn't
> this be declared volatile?  (I'm not 100% sure one way or the other.)
Will do the rename.  As for the volatile qualifier, I don't think it is
needed here.  _glapi_SingleThreaded is changed only by the second
thread, and the only user at that time is the first thread.  It doesn't
matter if compiler emits code that uses the cached value of
_glapi_SingleThreaded because the first thread will still be able to
access its current context/dispatch from global storage.
> >  #  define GET_DISPATCH() \
> > -   ((__builtin_expect( _glapi_Dispatch != NULL, 1 )) \
> > +   ((!_glapi_ThreadSafe) \
> >         ? _glapi_Dispatch : _glapi_get_dispatch())
> Keep the __builtin_expect.  Applications almost always use OpenGL from a
> single thread even if the application is multithreaded.
Will do.

-- 
Regards,
olv

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mesa3d-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Reply via email to