mapi: do not call thread-unsafe dispatch getter

Graphics / Mesa 3D Graphics Library / Mesa - Erik Faye-Lund [] - 26 October 2020 12:35 UTC

When not using the USE_ELF_TLS code-path, this function is thread-unsafe, because it returns u_current_table if set without consulting the ThreadSafe variable in u_current.c.

There's a short period where this can cause problems, if a program uses multiple threads, but only have made a single context current so far. If the program issues OpenGL commands from the initialized thread while a new thread is setting u_current_table to __glapi_noop_table, we will return the wrong table here.

It doesn't seem right to have two versions of the code that does the same anyway, so let's use the version that doesn't have this problem instead.

61d40ae4d04 mapi: do not call thread-unsafe dispatch getter
src/mapi/entry.c | 2 +-
src/mapi/u_current.h | 11 -----------
2 files changed, 1 insertion(+), 12 deletions(-)


  • Share