glapi: Protect _glapi_check_multithread by a mutex.
glapi: Protect _glapi_check_multithread by a mutex.

Multiple threads might call _glapi_check_multithread at roughly the same
time.  It is possbile that all of them are wrongly regarded as firstCall
if there is no mutex.  This bug causes xeglthreads to crash sometimes.

Acked-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>
Signed-off-by: Chia-I Wu <1c78ba4519acc7012ab6d28d2e5ef6630c8f0d2e@gmail.com>

djreep81/glsl-optimizer,mcanthony/glsl-optimizer,zeux/glsl-optimizer,mapbox/glsl-optimizer,adobe/glsl2agal,wolf96/glsl-optimizer,wolf96/glsl-optimizer,djreep81/glsl-optimizer,djreep81/glsl-optimizer,benaadams/glsl-optimizer,mapbox/glsl-optimizer,zeux/glsl-optimizer,mcanthony/glsl-optimizer,benaadams/glsl-optimizer,zeux/glsl-optimizer,KTXSoftware/glsl2agal,djreep81/glsl-optimizer,metora/MesaGLSLCompiler,benaadams/glsl-optimizer,KTXSoftware/glsl2agal,tokyovigilante/glsl-optimizer,bkaradzic/glsl-optimizer,KTXSoftware/glsl2agal,bkaradzic/glsl-optimizer,tokyovigilante/glsl-optimizer,dellis1972/glsl-optimizer,jbarczak/glsl-optimizer,jbarczak/glsl-optimizer,mcanthony/glsl-optimizer,wolf96/glsl-optimizer,benaadams/glsl-optimizer,mcanthony/glsl-optimizer,mapbox/glsl-optimizer,dellis1972/glsl-optimizer,tokyovigilante/glsl-optimizer,wolf96/glsl-optimizer,benaadams/glsl-optimizer,dellis1972/glsl-optimizer,zz85/glsl-optimizer,tokyovigilante/glsl-optimizer,KTXSoftware/glsl2agal,jbarczak/glsl-optimizer,wolf96/glsl-optimizer,adobe/glsl2agal,djreep81/glsl-optimizer,zeux/glsl-optimizer,zz85/glsl-optimizer,zeux/glsl-optimizer,dellis1972/glsl-optimizer,benaadams/glsl-optimizer,jbarczak/glsl-optimizer,adobe/glsl2agal,mapbox/glsl-optimizer,tokyovigilante/glsl-optimizer,adobe/glsl2agal,zz85/glsl-optimizer,zz85/glsl-optimizer,KTXSoftware/glsl2agal,adobe/glsl2agal,jbarczak/glsl-optimizer,zz85/glsl-optimizer,mcanthony/glsl-optimizer,bkaradzic/glsl-optimizer,metora/MesaGLSLCompiler,bkaradzic/glsl-optimizer,bkaradzic/glsl-optimizer,zz85/glsl-optimizer,metora/MesaGLSLCompiler,dellis1972/glsl-optimizer,mapbox/glsl-optimizer