We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1881

Summary: SDL will not compile with "SDL_THREADS" disabled.
Product: SDL Reporter: MakoEnergy02
Component: threadAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.0   
Hardware: x86   
OS: Windows (All)   
Attachments: Generic thread implementation patch.

Description MakoEnergy02 2013-05-31 16:49:56 UTC
I am attempting to compile SDL on WindowsXP 32-bit, using MinGW.  The problem I am having is when I attempt to compile, when it gets to "SDL_systhread.c" it errors:

C:\Repos\Mezzanine\Mezzanine\libincludes\common\sdlsrc\SDL\src\thread\generic\SDL_systhread.c|29|error: conflicting types for 'SDL_SYS_CreateThread'
C:\Repos\Mezzanine\Mezzanine\libincludes\common\sdlsrc\SDL\src\thread\generic\..\SDL_systhread.h|35|note: previous declaration of 'SDL_SYS_CreateThread' was here

I do have SDL_THREADS disabled in my cmake configuration as I do not want or need SDL making threads for me, I have another thread provider.  It seems the generic "dummy" implementation does not account for the two extra parameters needed for the "SDL_SYS_CreateThread" method when "SDL_PASSED_BEGINTHREAD_ENDTHREAD" is defined.

It seems to me that the generic implementation needs to simple add an #ifdef and implement an additional dummy method with the two extra parameters, unless I am misunderstanding the system.
Comment 1 MakoEnergy02 2013-05-31 17:49:17 UTC
Created attachment 1163 [details]
Generic thread implementation patch.
Comment 2 MakoEnergy02 2013-05-31 17:50:25 UTC
I looked at the windows thread implementation and used that as a reference to add the minimalist implementation of what I was referring to, and managed to resolve that compilation issue.  

I have attached a .patch file I generated using TortoiseGit showing the changes.
Comment 3 Sam Lantinga 2013-06-02 04:13:58 UTC
Thanks for the patch, it looks good.
http://hg.libsdl.org/SDL/rev/be3edef98d4b

Keep in mind though, this also prevents SDL from using threads internally which can break things like audio and joystick hotplug detection.  You probably want to compile SDL with thread support, and just use your own threads in your code.  There shouldn't be any conflict if you do this.