Renamed SDL_PostSemaphore() to SDL_SignalSemphore()

This commit is contained in:
Sam Lantinga committed 2024-07-24 13:37:40 -07:00
1 parent 27f86cbe18
commit a7c0192017
31 files changed
+66 -66

No files matched your search

+2 -2
View File
@@ -85,7 +85,7 @@ static void AAUDIO_errorCallback(AAudioStream *stream, void *userData, aaudio_re
// Just flag the device so we can kill it in PlayDevice instead.
SDL_AudioDevice *device = (SDL_AudioDevice *) userData;
SDL_AtomicSet(&device->hidden->error_callback_triggered, (int) error); // AAUDIO_OK is zero, so !triggered means no error.
SDL_PostSemaphore(device->hidden->semaphore); // in case we're blocking in WaitDevice.
SDL_SignalSemaphore(device->hidden->semaphore); // in case we're blocking in WaitDevice.
}
static aaudio_data_callback_result_t AAUDIO_dataCallback(AAudioStream *stream, void *userData, void *audioData, int32_t numFrames)
@@ -149,7 +149,7 @@ static aaudio_data_callback_result_t AAUDIO_dataCallback(AAudioStream *stream, v
size_t new_buffer_index = hidden->callback_bytes / device->buffer_size;
while (old_buffer_index < new_buffer_index) {
// Trigger audio processing
SDL_PostSemaphore(hidden->semaphore);
SDL_SignalSemaphore(hidden->semaphore);
++old_buffer_index;
}
+2 -2
View File
@@ -831,12 +831,12 @@ static int AudioQueueThreadEntry(void *arg)
if (PrepareAudioQueue(device) < 0) {
device->hidden->thread_error = SDL_strdup(SDL_GetError());
SDL_PostSemaphore(device->hidden->ready_semaphore);
SDL_SignalSemaphore(device->hidden->ready_semaphore);
return 0;
}
// init was successful, alert parent thread and start running...
SDL_PostSemaphore(device->hidden->ready_semaphore);
SDL_SignalSemaphore(device->hidden->ready_semaphore);
// This would be WaitDevice/WaitRecordingDevice in the normal SDL audio thread, but we get *BufferReadyCallback calls here to know when to iterate.
while (!SDL_AtomicGet(&device->shutdown)) {
+3 -3
View File
@@ -194,7 +194,7 @@ static void bqRecorderCallback(SLAndroidSimpleBufferQueueItf bq, void *context)
struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *)context;
LOGV("SLES: Recording Callback");
SDL_PostSemaphore(audiodata->playsem);
SDL_SignalSemaphore(audiodata->playsem);
}
static void OPENSLES_DestroyPCMRecorder(SDL_AudioDevice *device)
@@ -390,7 +390,7 @@ static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context)
struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *)context;
LOGV("SLES: Playback Callback");
SDL_PostSemaphore(audiodata->playsem);
SDL_SignalSemaphore(audiodata->playsem);
}
static void OPENSLES_DestroyPCMPlayer(SDL_AudioDevice *device)
@@ -673,7 +673,7 @@ static int OPENSLES_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int
// If Enqueue fails, callback won't be called.
// Post the semaphore, not to run out of buffer
if (SL_RESULT_SUCCESS != result) {
SDL_PostSemaphore(audiodata->playsem);
SDL_SignalSemaphore(audiodata->playsem);
}
return 0;
+1 -1
View File
@@ -921,7 +921,7 @@ static int SDLCALL HotplugThread(void *data)
// don't WaitForPulseOperation on the subscription; when it's done we'll be able to get hotplug events, but waiting doesn't changing anything.
op = PULSEAUDIO_pa_context_subscribe(pulseaudio_context, PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE | PA_SUBSCRIPTION_MASK_SERVER, NULL, NULL);
SDL_PostSemaphore((SDL_Semaphore *) data);
SDL_SignalSemaphore((SDL_Semaphore *) data);
while (SDL_AtomicGet(&pulseaudio_hotplug_thread_active)) {
PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop);
+3 -3
View File
@@ -83,7 +83,7 @@ static void ManagementThreadMainloop(void)
task->result = task->fn(task->userdata); // run this task.
if (task->task_complete_sem) { // something waiting on result?
task->errorstr = SDL_strdup(SDL_GetError());
SDL_PostSemaphore(task->task_complete_sem);
SDL_SignalSemaphore(task->task_complete_sem);
} else { // nothing waiting, we're done, free it.
SDL_free(task);
}
@@ -190,11 +190,11 @@ static int ManagementThreadEntry(void *userdata)
if (ManagementThreadPrepare() < 0) {
data->errorstr = SDL_strdup(SDL_GetError());
SDL_PostSemaphore(data->ready_sem); // unblock calling thread.
SDL_SignalSemaphore(data->ready_sem); // unblock calling thread.
return 0;
}
SDL_PostSemaphore(data->ready_sem); // unblock calling thread.
SDL_SignalSemaphore(data->ready_sem); // unblock calling thread.
ManagementThreadMainloop();
WASAPI_PlatformDeinit();
+2 -2
View File
@@ -186,7 +186,7 @@ void SDL_WasapiDeviceEventHandler::OnEnumerationCompleted(DeviceWatcher ^ sender
{
SDL_assert(sender == this->watcher);
if (this->completed_semaphore) {
SDL_PostSemaphore(this->completed_semaphore);
SDL_SignalSemaphore(this->completed_semaphore);
}
}
@@ -283,7 +283,7 @@ HRESULT
SDL_WasapiActivationHandler::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *async)
{
// Just set a flag, since we're probably in a different thread. We'll pick it up and init everything on our own thread to prevent races.
SDL_PostSemaphore(completion_semaphore);
SDL_SignalSemaphore(completion_semaphore);
return S_OK;
}