[SDL_threads] SDL_CondCreate equivalent for WIN32 missing?

Hello,

I’m planning to use SDL_Cond* API in my code, but for windows-based
platforms, its implementation is missing. I’ve already noticed this post
http://forums.libsdl.org/viewtopic.php?t=4445&start=0&postdays=0&postorder=asc&highlight=sdlcondsignalfrom
2009. Could the age of that post mean, that there will be no
implementation e.g. through CreateEvent, SetEvent, WaitForObject,… Windows
APIs in near future?

You could use http://www.sourceware.org/pthreads-win32/ wrapped around
the SDL API. Or one could try to make an SDL-internal implementation
based on semaphores and linked lists similar to the pthreads lib.

Hope that helps,
–AndreasOn 5/10/11 5:48 AM, Pete Lefis wrote:

Hello,

I’m planning to use SDL_Cond* API in my code, but for windows-based
platforms, its implementation is missing. I’ve already noticed this
post
http://forums.libsdl.org/viewtopic.php?t=4445&start=0&postdays=0&postorder=asc&highlight=sdlcondsignal
http://forums.libsdl.org/viewtopic.php?t=4445&start=0&postdays=0&postorder=asc&highlight=sdlcondsignal
from 2009. Could the age of that post mean, that there will be no
implementation e.g. through CreateEvent, SetEvent, WaitForObject,…
Windows APIs in near future?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Condition variables aren’t natively supported by Windows until Windows 7 (l
ink http://msdn.microsoft.com/en-us/library/ms682052(v=vs.85).aspx) and
emulation of them isn’t perfect for versions < 7; the topic is already well
researched (link http://www1.cse.wustl.edu/~schmidt/win32-cv-1.html). I
thought thread/generic/ had implementations of CVs using other primitives
and that they were available for Win32 (I seem to recall a friend of mine
using them on Win32 before). Are you sure those aren’t being compiled in?

PatrickOn Tue, May 10, 2011 at 7:48 AM, Pete Lefis wrote:

Hello,

I’m planning to use SDL_Cond* API in my code, but for windows-based
platforms, its implementation is missing. I’ve already noticed this post
http://forums.libsdl.org/viewtopic.php?t=4445&start=0&postdays=0&postorder=asc&highlight=sdlcondsignalfrom 2009. Could the age of that post mean, that there will be no
implementation e.g. through CreateEvent, SetEvent, WaitForObject,… Windows
APIs in near future?


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

You have to use the ‘dummy’ condition code. While the win32 “event” functions generally operate as a condition, they do not feature everything expected and as such can’t be used without breaking old code.
SDL aims to support as many targets as possible, and it is difficult for the developer using SDL to make two releases (one for >Win7, another for <=Win7).------------------------
EM3 Nathaniel Fries, U.S. Navy

http://natefries.net/