Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is SDL_Delay() thread safe?

Tags:

c++

pthreads

sdl

I have been working on a C++ project that uses SDL, and wonder if it is safe to call SDL_Delay concurrently from different threads or if I need to write a wrapper to serialize access to the function. I rather avoid any overhead, as the delays I need are very small.

Has anyone have tried this?

I am using c++ on OS X and pthreads, and need the code to be portable.

like image 487
cjcela Avatar asked Dec 06 '25 19:12

cjcela


1 Answers

I don't have any direct experience with SDL_Delay but according to: this documentation it is not thread safe and you should probably use a wrapper.

like image 121
Holtorf Avatar answered Dec 08 '25 13:12

Holtorf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!