[HOpenGL] HOpenGL and --enable-threaded-rts

Glynn Clements glynn.clements@virgin.net
Tue, 18 Jun 2002 16:07:41 +0100


Simon Marlow wrote:

> The trouble is that there isn't a single object representing the whole
> thread-local state.  Does OpenGL use pthread_getspecific() and
> pthread_setspecific() to access its thread-local state?

The libGL supplied with XFree86 uses xthread_{get,set}_specific. These
are macros which expand to the appropriate native function, one of:

	thr_{set,get}specific
	Tls{Set,Get}Value
	tis_{set,get}specific
	pthread_{set,get}specific

The XFree86 libGL source code carries SGI copyright notices, so it's a
good bet that that other Unix OpenGL implementations are similar.

Mesa's libGL has a similar abstraction, _glthread_{Get,Set}TSD. These
are functions which call the appropriate native function. Mesa
supports the thr_*, pthread_* and Tls* functions, but not the tis_*
functions; however, it also has versions which use the xthread_*
macros.

I have no idea as to the situation on Windows.

-- 
Glynn Clements <glynn.clements@virgin.net>