Does anyone know what the compiler flag -D_THREAD_SAFE does? It’s added by sdl2-config --cflags. I couldn’t find anything particularly helpful and current about it online.

Low-impact question, just curious :slight_smile:

It basically makes the program able to run multiple threads at once, which means that it is able to run multiple tasks at the same time without causing issues.

A program can run multiple threads at once without that flag. If it’s making something thread-safe that otherwise would not be thread-safe, I’m curious what and how.

From what I’ve read in the last 20 minutes or so, it has become somewhat deprecated, but we probably have it there for backward compatibility with older versions of FreeBSD and similar.
This link implies that is actually a command “-D” and an argument “_THREAD_SAFE”

1 Like

It seems to have been necessary in order to make certain functions thread-safe in older versions of glibc but later versions says it’s “obsolete”. Not sure if it affects anything else.

1 Like