#include <functiondiscoverykeys.h> // PKEY_Device_FriendlyName\r
#endif\r
\r
+#include <process.h>\r
+\r
#include "pa_util.h"\r
#include "pa_allocation.h"\r
#include "pa_hostapi.h"\r
#define PORTAUDIO_SHAREMODE AUDCLNT_SHAREMODE_SHARED\r
//#define PORTAUDIO_SHAREMODE AUDCLNT_SHAREMODE_EXCLUSIVE\r
\r
-\r
+/* use CreateThread for CYGWIN, _beginthreadex for all others */\r
+#ifndef __CYGWIN__\r
+#define CREATE_THREAD (HANDLE) _beginthreadex(NULL, 0, (unsigned (_stdcall *)(void *))ProcThread, (LPVOID) stream, 0, (unsigned *)&stream->dwThreadId)\r
+#else\r
+#define CREATE_THREAD CreateThread(NULL, 0, ProcThread, (LPVOID) stream, 0, &stream->dwThreadId)\r
+#endif\r
\r
/* prototypes for functions declared in this file */\r
\r
}\r
\r
// Create a thread for this client.\r
- stream->hThread = CreateThread(\r
- NULL, // no security attribute\r
- 0, // default stack size\r
- ProcThread,\r
- (LPVOID) stream, // thread parameter\r
- 0, // not suspended\r
- &stream->dwThreadId); // returns thread ID\r
-\r
+ stream->hThread = CREATE_THREAD;\r
+ \r
if (stream->hThread == NULL)\r
return paUnanticipatedHostError;\r
\r