From 75725608f3017feedd06165f9d559bff36c33c45 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Tue, 25 May 2021 14:56:56 +0300
Subject: [PATCH] SDL_thread.h: move libc header includes before begin_code.h.
---
include/SDL_thread.h | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/include/SDL_thread.h b/include/SDL_thread.h
index be0601cc9..513d5dfcb 100644
--- a/include/SDL_thread.h
+++ b/include/SDL_thread.h
@@ -35,6 +35,17 @@
#include "SDL_atomic.h"
#include "SDL_mutex.h"
+#if defined(__WIN32__)
+#include <process.h> /* _beginthreadex() and _endthreadex() */
+#endif
+#if defined(__OS2__) /* for _beginthread() and _endthread() */
+#ifndef __EMX__
+#include <process.h>
+#else
+#include <stdlib.h>
+#endif
+#endif
+
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
@@ -99,7 +110,6 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data);
* library!
*/
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#include <process.h> /* _beginthreadex() and _endthreadex() */
typedef uintptr_t (__cdecl * pfnSDL_CurrentBeginThread)
(void *, unsigned, unsigned (__stdcall *func)(void *),
@@ -148,12 +158,6 @@ SDL_CreateThreadWithStackSize(int (SDLCALL * fn) (void *),
*/
#define SDL_PASSED_BEGINTHREAD_ENDTHREAD
-#ifndef __EMX__
-#include <process.h>
-#else
-#include <stdlib.h>
-#endif
-
typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/);
typedef void (*pfnSDL_CurrentEndThread)(void);