[SDL] Thread creation in the beginning of SDL initialization and thread safety.

Michael Menegakis arxeio at gmail.com
Sun Dec 5 09:55:05 PST 2010


On Sun, Dec 5, 2010 at 6:50 PM, Brian Barrett <brian.ripoff at gmail.com> wrote:
> They probably mean that before any thread that will be using cURL is
> spawned the "thread safety" needs to be initialised. If two or more
> threads tried to initialise the "thread safety" then you could get
> race conditions or resource leaks, or worse I imagine.
>
> Any unrelated threads are probably not worth worrying about. They
> certainly shouldn't be calling cURL functions, so you should be safe.
>
> On 5 December 2010 11:43, Michael Menegakis <arxeio at gmail.com> wrote:
>> I noticed that SDL is shown by the debugger to be spawning a few
>> threads in the beginning of SDL initialization [at least on OpenGL
>> context]. That's usually not of my concern, however, I noticed that a
>> tool I have to use [cURL] requires for thread safety to be initialized
>> before any thread creation. Are those threads of any real concern in
>> such concepts, or they can be generally be ignored? [are they just a
>> way for debugger to say 'I just used a DLL' etc.?]

They say the opposite.

"This function is not thread safe. You must not call it when any other
thread in the program (i.e. a thread sharing the same memory) is
running. This doesn't just mean no other thread that is using libcurl.
Because curl_global_init() calls functions of other libraries that are
similarly thread unsafe, it could conflict with any other thread that
uses these other libraries."

http://curl.haxx.se/libcurl/c/curl_global_init.html



More information about the SDL mailing list