mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-08-27 17:11:37 +00:00
thread: Reworked SDL_CreateThread to be consistent across platforms.
Also documented missing and weird bits, rename typedefs to fit SDL standards.
This commit is contained in:
@@ -1633,10 +1633,9 @@ static int OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec
|
||||
|
||||
// Start the audio thread if necessary
|
||||
if (!current_audio.impl.ProvidesOwnCallbackThread) {
|
||||
const size_t stacksize = 0; // just take the system default, since audio streams might have callbacks.
|
||||
char threadname[64];
|
||||
SDL_GetAudioThreadName(device, threadname, sizeof (threadname));
|
||||
device->thread = SDL_CreateThreadInternal(device->iscapture ? CaptureAudioThread : OutputAudioThread, threadname, stacksize, device);
|
||||
device->thread = SDL_CreateThread(device->iscapture ? CaptureAudioThread : OutputAudioThread, threadname, device);
|
||||
|
||||
if (!device->thread) {
|
||||
ClosePhysicalAudioDevice(device);
|
||||
|
||||
@@ -952,7 +952,7 @@ static int COREAUDIO_OpenDevice(SDL_AudioDevice *device)
|
||||
|
||||
char threadname[64];
|
||||
SDL_GetAudioThreadName(device, threadname, sizeof(threadname));
|
||||
device->hidden->thread = SDL_CreateThreadInternal(AudioQueueThreadEntry, threadname, 0, device);
|
||||
device->hidden->thread = SDL_CreateThread(AudioQueueThreadEntry, threadname, device);
|
||||
if (!device->hidden->thread) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -978,7 +978,7 @@ static void PULSEAUDIO_DetectDevices(SDL_AudioDevice **default_output, SDL_Audio
|
||||
|
||||
// ok, we have a sane list, let's set up hotplug notifications now...
|
||||
SDL_AtomicSet(&pulseaudio_hotplug_thread_active, 1);
|
||||
pulseaudio_hotplug_thread = SDL_CreateThreadInternal(HotplugThread, "PulseHotplug", 256 * 1024, ready_sem); // !!! FIXME: this can probably survive in significantly less stack space.
|
||||
pulseaudio_hotplug_thread = SDL_CreateThreadWithStackSize(HotplugThread, "PulseHotplug", 256 * 1024, ready_sem); // !!! FIXME: this can probably survive in significantly less stack space.
|
||||
SDL_WaitSemaphore(ready_sem);
|
||||
SDL_DestroySemaphore(ready_sem);
|
||||
}
|
||||
|
||||
@@ -210,7 +210,7 @@ static int InitManagementThread(void)
|
||||
|
||||
SDL_AtomicSetPtr((void **) &ManagementThreadPendingTasks, NULL);
|
||||
SDL_AtomicSet(&ManagementThreadShutdown, 0);
|
||||
ManagementThread = SDL_CreateThreadInternal(ManagementThreadEntry, "SDLWASAPIMgmt", 256 * 1024, &mgmtdata); // !!! FIXME: maybe even smaller stack size?
|
||||
ManagementThread = SDL_CreateThreadWithStackSize(ManagementThreadEntry, "SDLWASAPIMgmt", 256 * 1024, &mgmtdata); // !!! FIXME: maybe even smaller stack size?
|
||||
if (!ManagementThread) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user