Renamed SDL_PostSemaphore() to SDL_SignalSemphore()

This commit is contained in:
Sam Lantinga 2024-07-24 12:39:30 -07:00
parent 27f86cbe18
commit a7c0192017
31 changed files with 66 additions and 66 deletions

View file

@ -2511,7 +2511,7 @@ typedef SDL_atomic_t, SDL_AtomicInt;
@@ @@
@@ @@
- SDL_SemPost - SDL_SemPost
+ SDL_PostSemaphore + SDL_SignalSemaphore
(...) (...)
@@ @@
@@ @@

View file

@ -1110,7 +1110,7 @@ The following functions have been renamed:
* SDL_CondWaitTimeout() => SDL_WaitConditionTimeout() * SDL_CondWaitTimeout() => SDL_WaitConditionTimeout()
* SDL_CreateCond() => SDL_CreateCondition() * SDL_CreateCond() => SDL_CreateCondition()
* SDL_DestroyCond() => SDL_DestroyCondition() * SDL_DestroyCond() => SDL_DestroyCondition()
* SDL_SemPost() => SDL_PostSemaphore() * SDL_SemPost() => SDL_SignalSemaphore()
* SDL_SemTryWait() => SDL_TryWaitSemaphore() * SDL_SemTryWait() => SDL_TryWaitSemaphore()
* SDL_SemValue() => SDL_GetSemaphoreValue() * SDL_SemValue() => SDL_GetSemaphoreValue()
* SDL_SemWait() => SDL_WaitSemaphore() * SDL_SemWait() => SDL_WaitSemaphore()

View file

@ -544,7 +544,7 @@ typedef struct SDL_Semaphore SDL_Semaphore;
* \since This function is available since SDL 3.0.0. * \since This function is available since SDL 3.0.0.
* *
* \sa SDL_DestroySemaphore * \sa SDL_DestroySemaphore
* \sa SDL_PostSemaphore * \sa SDL_SignalSemaphore
* \sa SDL_TryWaitSemaphore * \sa SDL_TryWaitSemaphore
* \sa SDL_GetSemaphoreValue * \sa SDL_GetSemaphoreValue
* \sa SDL_WaitSemaphore * \sa SDL_WaitSemaphore
@ -583,7 +583,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroySemaphore(SDL_Semaphore *sem);
* *
* \since This function is available since SDL 3.0.0. * \since This function is available since SDL 3.0.0.
* *
* \sa SDL_PostSemaphore * \sa SDL_SignalSemaphore
* \sa SDL_TryWaitSemaphore * \sa SDL_TryWaitSemaphore
* \sa SDL_WaitSemaphoreTimeout * \sa SDL_WaitSemaphoreTimeout
*/ */
@ -604,7 +604,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem);
* *
* \since This function is available since SDL 3.0.0. * \since This function is available since SDL 3.0.0.
* *
* \sa SDL_PostSemaphore * \sa SDL_SignalSemaphore
* \sa SDL_WaitSemaphore * \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout * \sa SDL_WaitSemaphoreTimeout
*/ */
@ -626,7 +626,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem);
* *
* \since This function is available since SDL 3.0.0. * \since This function is available since SDL 3.0.0.
* *
* \sa SDL_PostSemaphore * \sa SDL_SignalSemaphore
* \sa SDL_TryWaitSemaphore * \sa SDL_TryWaitSemaphore
* \sa SDL_WaitSemaphore * \sa SDL_WaitSemaphore
*/ */
@ -645,7 +645,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sin
* \sa SDL_WaitSemaphore * \sa SDL_WaitSemaphore
* \sa SDL_WaitSemaphoreTimeout * \sa SDL_WaitSemaphoreTimeout
*/ */
extern SDL_DECLSPEC int SDLCALL SDL_PostSemaphore(SDL_Semaphore *sem); extern SDL_DECLSPEC int SDLCALL SDL_SignalSemaphore(SDL_Semaphore *sem);
/** /**
* Get the current value of a semaphore. * Get the current value of a semaphore.

View file

@ -444,7 +444,7 @@
#define SDL_CondWaitTimeout SDL_WaitConditionTimeout #define SDL_CondWaitTimeout SDL_WaitConditionTimeout
#define SDL_CreateCond SDL_CreateCondition #define SDL_CreateCond SDL_CreateCondition
#define SDL_DestroyCond SDL_DestroyCondition #define SDL_DestroyCond SDL_DestroyCondition
#define SDL_SemPost SDL_PostSemaphore #define SDL_SemPost SDL_SignalSemaphore
#define SDL_SemTryWait SDL_TryWaitSemaphore #define SDL_SemTryWait SDL_TryWaitSemaphore
#define SDL_SemValue SDL_GetSemaphoreValue #define SDL_SemValue SDL_GetSemaphoreValue
#define SDL_SemWait SDL_WaitSemaphore #define SDL_SemWait SDL_WaitSemaphore
@ -1065,7 +1065,7 @@
#define SDL_CondWaitTimeout SDL_CondWaitTimeout_renamed_SDL_WaitConditionTimeout #define SDL_CondWaitTimeout SDL_CondWaitTimeout_renamed_SDL_WaitConditionTimeout
#define SDL_CreateCond SDL_CreateCond_renamed_SDL_CreateCondition #define SDL_CreateCond SDL_CreateCond_renamed_SDL_CreateCondition
#define SDL_DestroyCond SDL_DestroyCond_renamed_SDL_DestroyCondition #define SDL_DestroyCond SDL_DestroyCond_renamed_SDL_DestroyCondition
#define SDL_SemPost SDL_SemPost_renamed_SDL_PostSemaphore #define SDL_SemPost SDL_SemPost_renamed_SDL_SignalSemaphore
#define SDL_SemTryWait SDL_SemTryWait_renamed_SDL_TryWaitSemaphore #define SDL_SemTryWait SDL_SemTryWait_renamed_SDL_TryWaitSemaphore
#define SDL_SemValue SDL_SemValue_renamed_SDL_GetSemaphoreValue #define SDL_SemValue SDL_SemValue_renamed_SDL_GetSemaphoreValue
#define SDL_SemWait SDL_SemWait_renamed_SDL_WaitSemaphore #define SDL_SemWait SDL_SemWait_renamed_SDL_WaitSemaphore

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. // Just flag the device so we can kill it in PlayDevice instead.
SDL_AudioDevice *device = (SDL_AudioDevice *) userData; 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_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) 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; size_t new_buffer_index = hidden->callback_bytes / device->buffer_size;
while (old_buffer_index < new_buffer_index) { while (old_buffer_index < new_buffer_index) {
// Trigger audio processing // Trigger audio processing
SDL_PostSemaphore(hidden->semaphore); SDL_SignalSemaphore(hidden->semaphore);
++old_buffer_index; ++old_buffer_index;
} }

View file

@ -831,12 +831,12 @@ static int AudioQueueThreadEntry(void *arg)
if (PrepareAudioQueue(device) < 0) { if (PrepareAudioQueue(device) < 0) {
device->hidden->thread_error = SDL_strdup(SDL_GetError()); device->hidden->thread_error = SDL_strdup(SDL_GetError());
SDL_PostSemaphore(device->hidden->ready_semaphore); SDL_SignalSemaphore(device->hidden->ready_semaphore);
return 0; return 0;
} }
// init was successful, alert parent thread and start running... // 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. // 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)) { while (!SDL_AtomicGet(&device->shutdown)) {

View file

@ -194,7 +194,7 @@ static void bqRecorderCallback(SLAndroidSimpleBufferQueueItf bq, void *context)
struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *)context; struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *)context;
LOGV("SLES: Recording Callback"); LOGV("SLES: Recording Callback");
SDL_PostSemaphore(audiodata->playsem); SDL_SignalSemaphore(audiodata->playsem);
} }
static void OPENSLES_DestroyPCMRecorder(SDL_AudioDevice *device) 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; struct SDL_PrivateAudioData *audiodata = (struct SDL_PrivateAudioData *)context;
LOGV("SLES: Playback Callback"); LOGV("SLES: Playback Callback");
SDL_PostSemaphore(audiodata->playsem); SDL_SignalSemaphore(audiodata->playsem);
} }
static void OPENSLES_DestroyPCMPlayer(SDL_AudioDevice *device) 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. // If Enqueue fails, callback won't be called.
// Post the semaphore, not to run out of buffer // Post the semaphore, not to run out of buffer
if (SL_RESULT_SUCCESS != result) { if (SL_RESULT_SUCCESS != result) {
SDL_PostSemaphore(audiodata->playsem); SDL_SignalSemaphore(audiodata->playsem);
} }
return 0; return 0;

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. // 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); 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)) { while (SDL_AtomicGet(&pulseaudio_hotplug_thread_active)) {
PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop); PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop);

View file

@ -83,7 +83,7 @@ static void ManagementThreadMainloop(void)
task->result = task->fn(task->userdata); // run this task. task->result = task->fn(task->userdata); // run this task.
if (task->task_complete_sem) { // something waiting on result? if (task->task_complete_sem) { // something waiting on result?
task->errorstr = SDL_strdup(SDL_GetError()); 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. } else { // nothing waiting, we're done, free it.
SDL_free(task); SDL_free(task);
} }
@ -190,11 +190,11 @@ static int ManagementThreadEntry(void *userdata)
if (ManagementThreadPrepare() < 0) { if (ManagementThreadPrepare() < 0) {
data->errorstr = SDL_strdup(SDL_GetError()); data->errorstr = SDL_strdup(SDL_GetError());
SDL_PostSemaphore(data->ready_sem); // unblock calling thread. SDL_SignalSemaphore(data->ready_sem); // unblock calling thread.
return 0; return 0;
} }
SDL_PostSemaphore(data->ready_sem); // unblock calling thread. SDL_SignalSemaphore(data->ready_sem); // unblock calling thread.
ManagementThreadMainloop(); ManagementThreadMainloop();
WASAPI_PlatformDeinit(); WASAPI_PlatformDeinit();

View file

@ -186,7 +186,7 @@ void SDL_WasapiDeviceEventHandler::OnEnumerationCompleted(DeviceWatcher ^ sender
{ {
SDL_assert(sender == this->watcher); SDL_assert(sender == this->watcher);
if (this->completed_semaphore) { if (this->completed_semaphore) {
SDL_PostSemaphore(this->completed_semaphore); SDL_SignalSemaphore(this->completed_semaphore);
} }
} }
@ -283,7 +283,7 @@ HRESULT
SDL_WasapiActivationHandler::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *async) 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. // 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; return S_OK;
} }

View file

@ -1370,7 +1370,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSendQuit)(
} }
/* Resume the event loop so that the app can catch SDL_EVENT_QUIT which /* Resume the event loop so that the app can catch SDL_EVENT_QUIT which
* should now be the top event in the event queue. */ * should now be the top event in the event queue. */
SDL_PostSemaphore(Android_ResumeSem); SDL_SignalSemaphore(Android_ResumeSem);
} }
/* Activity ends */ /* Activity ends */
@ -1412,7 +1412,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)(
/* Signal the pause semaphore so the event loop knows to pause and (optionally) block itself. /* Signal the pause semaphore so the event loop knows to pause and (optionally) block itself.
* Sometimes 2 pauses can be queued (eg pause/resume/pause), so it's always increased. */ * Sometimes 2 pauses can be queued (eg pause/resume/pause), so it's always increased. */
SDL_PostSemaphore(Android_PauseSem); SDL_SignalSemaphore(Android_PauseSem);
} }
/* Resume */ /* Resume */
@ -1425,7 +1425,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)(
* We can't restore the GL Context here because it needs to be done on the SDL main thread * We can't restore the GL Context here because it needs to be done on the SDL main thread
* and this function will be called from the Java thread instead. * and this function will be called from the Java thread instead.
*/ */
SDL_PostSemaphore(Android_ResumeSem); SDL_SignalSemaphore(Android_ResumeSem);
} }
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)( JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeFocusChanged)(

View file

@ -582,12 +582,12 @@ SDL3_0.0.0 {
SDL_Metal_GetLayer; SDL_Metal_GetLayer;
SDL_MinimizeWindow; SDL_MinimizeWindow;
SDL_MixAudio; SDL_MixAudio;
SDL_OnApplicationDidEnterForeground;
SDL_OnApplicationDidChangeStatusBarOrientation; SDL_OnApplicationDidChangeStatusBarOrientation;
SDL_OnApplicationDidEnterBackground; SDL_OnApplicationDidEnterBackground;
SDL_OnApplicationDidEnterForeground;
SDL_OnApplicationDidReceiveMemoryWarning; SDL_OnApplicationDidReceiveMemoryWarning;
SDL_OnApplicationWillEnterForeground;
SDL_OnApplicationWillEnterBackground; SDL_OnApplicationWillEnterBackground;
SDL_OnApplicationWillEnterForeground;
SDL_OnApplicationWillTerminate; SDL_OnApplicationWillTerminate;
SDL_OpenAudioDevice; SDL_OpenAudioDevice;
SDL_OpenAudioDeviceStream; SDL_OpenAudioDeviceStream;
@ -612,7 +612,6 @@ SDL3_0.0.0 {
SDL_PenConnected; SDL_PenConnected;
SDL_PlayHapticRumble; SDL_PlayHapticRumble;
SDL_PollEvent; SDL_PollEvent;
SDL_PostSemaphore;
SDL_PremultiplyAlpha; SDL_PremultiplyAlpha;
SDL_PremultiplySurfaceAlpha; SDL_PremultiplySurfaceAlpha;
SDL_PumpEvents; SDL_PumpEvents;
@ -809,6 +808,7 @@ SDL3_0.0.0 {
SDL_ShowWindow; SDL_ShowWindow;
SDL_ShowWindowSystemMenu; SDL_ShowWindowSystemMenu;
SDL_SignalCondition; SDL_SignalCondition;
SDL_SignalSemaphore;
SDL_StartTextInput; SDL_StartTextInput;
SDL_StepUTF8; SDL_StepUTF8;
SDL_StopHapticEffect; SDL_StopHapticEffect;

View file

@ -607,12 +607,12 @@
#define SDL_Metal_GetLayer SDL_Metal_GetLayer_REAL #define SDL_Metal_GetLayer SDL_Metal_GetLayer_REAL
#define SDL_MinimizeWindow SDL_MinimizeWindow_REAL #define SDL_MinimizeWindow SDL_MinimizeWindow_REAL
#define SDL_MixAudio SDL_MixAudio_REAL #define SDL_MixAudio SDL_MixAudio_REAL
#define SDL_OnApplicationDidEnterForeground SDL_OnApplicationDidEnterForeground_REAL
#define SDL_OnApplicationDidChangeStatusBarOrientation SDL_OnApplicationDidChangeStatusBarOrientation_REAL #define SDL_OnApplicationDidChangeStatusBarOrientation SDL_OnApplicationDidChangeStatusBarOrientation_REAL
#define SDL_OnApplicationDidEnterBackground SDL_OnApplicationDidEnterBackground_REAL #define SDL_OnApplicationDidEnterBackground SDL_OnApplicationDidEnterBackground_REAL
#define SDL_OnApplicationDidEnterForeground SDL_OnApplicationDidEnterForeground_REAL
#define SDL_OnApplicationDidReceiveMemoryWarning SDL_OnApplicationDidReceiveMemoryWarning_REAL #define SDL_OnApplicationDidReceiveMemoryWarning SDL_OnApplicationDidReceiveMemoryWarning_REAL
#define SDL_OnApplicationWillEnterForeground SDL_OnApplicationWillEnterForeground_REAL
#define SDL_OnApplicationWillEnterBackground SDL_OnApplicationWillEnterBackground_REAL #define SDL_OnApplicationWillEnterBackground SDL_OnApplicationWillEnterBackground_REAL
#define SDL_OnApplicationWillEnterForeground SDL_OnApplicationWillEnterForeground_REAL
#define SDL_OnApplicationWillTerminate SDL_OnApplicationWillTerminate_REAL #define SDL_OnApplicationWillTerminate SDL_OnApplicationWillTerminate_REAL
#define SDL_OpenAudioDevice SDL_OpenAudioDevice_REAL #define SDL_OpenAudioDevice SDL_OpenAudioDevice_REAL
#define SDL_OpenAudioDeviceStream SDL_OpenAudioDeviceStream_REAL #define SDL_OpenAudioDeviceStream SDL_OpenAudioDeviceStream_REAL
@ -637,7 +637,6 @@
#define SDL_PenConnected SDL_PenConnected_REAL #define SDL_PenConnected SDL_PenConnected_REAL
#define SDL_PlayHapticRumble SDL_PlayHapticRumble_REAL #define SDL_PlayHapticRumble SDL_PlayHapticRumble_REAL
#define SDL_PollEvent SDL_PollEvent_REAL #define SDL_PollEvent SDL_PollEvent_REAL
#define SDL_PostSemaphore SDL_PostSemaphore_REAL
#define SDL_PremultiplyAlpha SDL_PremultiplyAlpha_REAL #define SDL_PremultiplyAlpha SDL_PremultiplyAlpha_REAL
#define SDL_PremultiplySurfaceAlpha SDL_PremultiplySurfaceAlpha_REAL #define SDL_PremultiplySurfaceAlpha SDL_PremultiplySurfaceAlpha_REAL
#define SDL_PumpEvents SDL_PumpEvents_REAL #define SDL_PumpEvents SDL_PumpEvents_REAL
@ -834,6 +833,7 @@
#define SDL_ShowWindow SDL_ShowWindow_REAL #define SDL_ShowWindow SDL_ShowWindow_REAL
#define SDL_ShowWindowSystemMenu SDL_ShowWindowSystemMenu_REAL #define SDL_ShowWindowSystemMenu SDL_ShowWindowSystemMenu_REAL
#define SDL_SignalCondition SDL_SignalCondition_REAL #define SDL_SignalCondition SDL_SignalCondition_REAL
#define SDL_SignalSemaphore SDL_SignalSemaphore_REAL
#define SDL_StartTextInput SDL_StartTextInput_REAL #define SDL_StartTextInput SDL_StartTextInput_REAL
#define SDL_StepUTF8 SDL_StepUTF8_REAL #define SDL_StepUTF8 SDL_StepUTF8_REAL
#define SDL_StopHapticEffect SDL_StopHapticEffect_REAL #define SDL_StopHapticEffect SDL_StopHapticEffect_REAL

View file

@ -618,12 +618,12 @@ SDL_DYNAPI_PROC(void,SDL_Metal_DestroyView,(SDL_MetalView a),(a),)
SDL_DYNAPI_PROC(void*,SDL_Metal_GetLayer,(SDL_MetalView a),(a),return) SDL_DYNAPI_PROC(void*,SDL_Metal_GetLayer,(SDL_MetalView a),(a),return)
SDL_DYNAPI_PROC(int,SDL_MinimizeWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_MinimizeWindow,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_MixAudio,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, float e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_MixAudio,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, float e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(void,SDL_OnApplicationDidEnterForeground,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationDidChangeStatusBarOrientation,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidChangeStatusBarOrientation,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationDidEnterBackground,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidEnterBackground,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationDidEnterForeground,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationDidReceiveMemoryWarning,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidReceiveMemoryWarning,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationWillEnterForeground,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationWillEnterBackground,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationWillEnterBackground,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationWillEnterForeground,(void),(),)
SDL_DYNAPI_PROC(void,SDL_OnApplicationWillTerminate,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationWillTerminate,(void),(),)
SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_OpenAudioDevice,(SDL_AudioDeviceID a, const SDL_AudioSpec *b),(a,b),return) SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_OpenAudioDevice,(SDL_AudioDeviceID a, const SDL_AudioSpec *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_OpenAudioDeviceStream,(SDL_AudioDeviceID a, const SDL_AudioSpec *b, SDL_AudioStreamCallback c, void *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_OpenAudioDeviceStream,(SDL_AudioDeviceID a, const SDL_AudioSpec *b, SDL_AudioStreamCallback c, void *d),(a,b,c,d),return)
@ -648,7 +648,6 @@ SDL_DYNAPI_PROC(int,SDL_PeepEvents,(SDL_Event *a, int b, SDL_EventAction c, Uint
SDL_DYNAPI_PROC(SDL_bool,SDL_PenConnected,(SDL_PenID a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_PenConnected,(SDL_PenID a),(a),return)
SDL_DYNAPI_PROC(int,SDL_PlayHapticRumble,(SDL_Haptic *a, float b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_PlayHapticRumble,(SDL_Haptic *a, float b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_PollEvent,(SDL_Event *a),(a),return) SDL_DYNAPI_PROC(SDL_bool,SDL_PollEvent,(SDL_Event *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_PostSemaphore,(SDL_Semaphore *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_PremultiplyAlpha,(int a, int b, SDL_PixelFormat c, const void *d, int e, SDL_PixelFormat f, void *g, int h, SDL_bool i),(a,b,c,d,e,f,g,h,i),return) SDL_DYNAPI_PROC(int,SDL_PremultiplyAlpha,(int a, int b, SDL_PixelFormat c, const void *d, int e, SDL_PixelFormat f, void *g, int h, SDL_bool i),(a,b,c,d,e,f,g,h,i),return)
SDL_DYNAPI_PROC(int,SDL_PremultiplySurfaceAlpha,(SDL_Surface *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_PremultiplySurfaceAlpha,(SDL_Surface *a, SDL_bool b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_PumpEvents,(void),(),) SDL_DYNAPI_PROC(void,SDL_PumpEvents,(void),(),)
@ -844,6 +843,7 @@ SDL_DYNAPI_PROC(int,SDL_ShowSimpleMessageBox,(SDL_MessageBoxFlags a, const char
SDL_DYNAPI_PROC(int,SDL_ShowWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_ShowWindow,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_ShowWindowSystemMenu,(SDL_Window *a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_ShowWindowSystemMenu,(SDL_Window *a, int b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_SignalCondition,(SDL_Condition *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SignalCondition,(SDL_Condition *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_SignalSemaphore,(SDL_Semaphore *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_StartTextInput,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_StartTextInput,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(Uint32,SDL_StepUTF8,(const char **a, size_t *b),(a,b),return) SDL_DYNAPI_PROC(Uint32,SDL_StepUTF8,(const char **a, size_t *b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_StopHapticEffect,(SDL_Haptic *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_StopHapticEffect,(SDL_Haptic *a, int b),(a,b),return)

View file

@ -107,7 +107,7 @@ static void SDL_HIDAPI_StopRumbleThread(SDL_HIDAPI_RumbleContext *ctx)
if (ctx->thread) { if (ctx->thread) {
int result; int result;
SDL_PostSemaphore(ctx->request_sem); SDL_SignalSemaphore(ctx->request_sem);
SDL_WaitThread(ctx->thread, &result); SDL_WaitThread(ctx->thread, &result);
ctx->thread = NULL; ctx->thread = NULL;
} }
@ -236,7 +236,7 @@ int SDL_HIDAPI_SendRumbleWithCallbackAndUnlock(SDL_HIDAPI_Device *device, const
/* Make sure we unlock before posting the semaphore so the rumble thread can run immediately */ /* Make sure we unlock before posting the semaphore so the rumble thread can run immediately */
SDL_HIDAPI_UnlockRumble(); SDL_HIDAPI_UnlockRumble();
SDL_PostSemaphore(ctx->request_sem); SDL_SignalSemaphore(ctx->request_sem);
return size; return size;
} }

View file

@ -65,7 +65,7 @@ static int SDLCALL SDL_ANDROID_SensorThread(void *data)
SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH); SDL_SetThreadPriority(SDL_THREAD_PRIORITY_HIGH);
SDL_sensor_looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS); SDL_sensor_looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS);
SDL_PostSemaphore(ctx->sem); SDL_SignalSemaphore(ctx->sem);
while (SDL_AtomicGet(&ctx->running)) { while (SDL_AtomicGet(&ctx->running)) {
Uint64 timestamp = SDL_GetTicksNS(); Uint64 timestamp = SDL_GetTicksNS();

View file

@ -103,7 +103,7 @@ int SDL_SignalCondition_generic(SDL_Condition *_cond)
SDL_LockMutex(cond->lock); SDL_LockMutex(cond->lock);
if (cond->waiting > cond->signals) { if (cond->waiting > cond->signals) {
++cond->signals; ++cond->signals;
SDL_PostSemaphore(cond->wait_sem); SDL_SignalSemaphore(cond->wait_sem);
SDL_UnlockMutex(cond->lock); SDL_UnlockMutex(cond->lock);
SDL_WaitSemaphore(cond->wait_done); SDL_WaitSemaphore(cond->wait_done);
} else { } else {
@ -133,7 +133,7 @@ int SDL_BroadcastCondition_generic(SDL_Condition *_cond)
num_waiting = (cond->waiting - cond->signals); num_waiting = (cond->waiting - cond->signals);
cond->signals = cond->waiting; cond->signals = cond->waiting;
for (i = 0; i < num_waiting; ++i) { for (i = 0; i < num_waiting; ++i) {
SDL_PostSemaphore(cond->wait_sem); SDL_SignalSemaphore(cond->wait_sem);
} }
/* Now all released threads are blocked here, waiting for us. /* Now all released threads are blocked here, waiting for us.
Collect them all (and win fabulous prizes!) :-) Collect them all (and win fabulous prizes!) :-)
@ -208,7 +208,7 @@ int SDL_WaitConditionTimeoutNS_generic(SDL_Condition *_cond, SDL_Mutex *mutex, S
SDL_WaitSemaphore(cond->wait_sem); SDL_WaitSemaphore(cond->wait_sem);
} }
/* We always notify the signal thread that we are done */ /* We always notify the signal thread that we are done */
SDL_PostSemaphore(cond->wait_done); SDL_SignalSemaphore(cond->wait_done);
/* Signal handshake complete */ /* Signal handshake complete */
--cond->signals; --cond->signals;

View file

@ -124,7 +124,7 @@ void SDL_UnlockMutex(SDL_Mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS // clang d
then release the lock semaphore. then release the lock semaphore.
*/ */
mutex->owner = 0; mutex->owner = 0;
SDL_PostSemaphore(mutex->sem); SDL_SignalSemaphore(mutex->sem);
} }
} }
#endif // SDL_THREADS_DISABLED #endif // SDL_THREADS_DISABLED

View file

@ -46,7 +46,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
return 0; return 0;
} }
int SDL_PostSemaphore(SDL_Semaphore *sem) int SDL_SignalSemaphore(SDL_Semaphore *sem)
{ {
return SDL_SetError("SDL not built with thread support"); return SDL_SetError("SDL not built with thread support");
} }
@ -153,7 +153,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
return value; return value;
} }
int SDL_PostSemaphore(SDL_Semaphore *sem) int SDL_SignalSemaphore(SDL_Semaphore *sem)
{ {
if (!sem) { if (!sem) {
return SDL_InvalidParamError("sem"); return SDL_InvalidParamError("sem");

View file

@ -105,7 +105,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
return sem->semaphore.current_count; return sem->semaphore.current_count;
} }
int SDL_PostSemaphore(SDL_Semaphore *sem) int SDL_SignalSemaphore(SDL_Semaphore *sem)
{ {
if (!sem) { if (!sem) {
return SDL_InvalidParamError("sem"); return SDL_InvalidParamError("sem");

View file

@ -147,7 +147,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
return sem->count; return sem->count;
} }
int SDL_PostSemaphore(SDL_Semaphore *sem) int SDL_SignalSemaphore(SDL_Semaphore *sem)
{ {
if (!sem) { if (!sem) {
return SDL_InvalidParamError("sem"); return SDL_InvalidParamError("sem");

View file

@ -121,7 +121,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
return 0; return 0;
} }
int SDL_PostSemaphore(SDL_Semaphore *sem) int SDL_SignalSemaphore(SDL_Semaphore *sem)
{ {
int res; int res;

View file

@ -124,7 +124,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
return 0; return 0;
} }
int SDL_PostSemaphore(SDL_Semaphore *sem) int SDL_SignalSemaphore(SDL_Semaphore *sem)
{ {
int res; int res;

View file

@ -162,7 +162,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
return (Uint32)ret; return (Uint32)ret;
} }
int SDL_PostSemaphore(SDL_Semaphore *sem) int SDL_SignalSemaphore(SDL_Semaphore *sem)
{ {
int retval; int retval;

View file

@ -126,7 +126,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
return 0; return 0;
} }
int SDL_PostSemaphore(SDL_Semaphore *sem) int SDL_SignalSemaphore(SDL_Semaphore *sem)
{ {
int res; int res;

View file

@ -39,7 +39,7 @@ typedef SDL_Semaphore *(*pfnSDL_CreateSemaphore)(Uint32);
typedef void (*pfnSDL_DestroySemaphore)(SDL_Semaphore *); typedef void (*pfnSDL_DestroySemaphore)(SDL_Semaphore *);
typedef int (*pfnSDL_WaitSemaphoreTimeoutNS)(SDL_Semaphore *, Sint64); typedef int (*pfnSDL_WaitSemaphoreTimeoutNS)(SDL_Semaphore *, Sint64);
typedef Uint32 (*pfnSDL_GetSemaphoreValue)(SDL_Semaphore *); typedef Uint32 (*pfnSDL_GetSemaphoreValue)(SDL_Semaphore *);
typedef int (*pfnSDL_PostSemaphore)(SDL_Semaphore *); typedef int (*pfnSDL_SignalSemaphore)(SDL_Semaphore *);
typedef struct SDL_semaphore_impl_t typedef struct SDL_semaphore_impl_t
{ {
@ -47,7 +47,7 @@ typedef struct SDL_semaphore_impl_t
pfnSDL_DestroySemaphore Destroy; pfnSDL_DestroySemaphore Destroy;
pfnSDL_WaitSemaphoreTimeoutNS WaitTimeoutNS; pfnSDL_WaitSemaphoreTimeoutNS WaitTimeoutNS;
pfnSDL_GetSemaphoreValue Value; pfnSDL_GetSemaphoreValue Value;
pfnSDL_PostSemaphore Post; pfnSDL_SignalSemaphore Post;
} SDL_sem_impl_t; } SDL_sem_impl_t;
/* Implementation will be chosen at runtime based on available Kernel features */ /* Implementation will be chosen at runtime based on available Kernel features */
@ -180,7 +180,7 @@ static Uint32 SDL_GetSemaphoreValue_atom(SDL_Semaphore *_sem)
return (Uint32)sem->count; return (Uint32)sem->count;
} }
static int SDL_PostSemaphore_atom(SDL_Semaphore *_sem) static int SDL_SignalSemaphore_atom(SDL_Semaphore *_sem)
{ {
SDL_sem_atom *sem = (SDL_sem_atom *)_sem; SDL_sem_atom *sem = (SDL_sem_atom *)_sem;
@ -199,7 +199,7 @@ static const SDL_sem_impl_t SDL_sem_impl_atom = {
&SDL_DestroySemaphore_atom, &SDL_DestroySemaphore_atom,
&SDL_WaitSemaphoreTimeoutNS_atom, &SDL_WaitSemaphoreTimeoutNS_atom,
&SDL_GetSemaphoreValue_atom, &SDL_GetSemaphoreValue_atom,
&SDL_PostSemaphore_atom, &SDL_SignalSemaphore_atom,
}; };
#endif /* !SDL_WINAPI_FAMILY_PHONE */ #endif /* !SDL_WINAPI_FAMILY_PHONE */
@ -292,7 +292,7 @@ static Uint32 SDL_GetSemaphoreValue_kern(SDL_Semaphore *_sem)
return (Uint32)sem->count; return (Uint32)sem->count;
} }
static int SDL_PostSemaphore_kern(SDL_Semaphore *_sem) static int SDL_SignalSemaphore_kern(SDL_Semaphore *_sem)
{ {
SDL_sem_kern *sem = (SDL_sem_kern *)_sem; SDL_sem_kern *sem = (SDL_sem_kern *)_sem;
if (!sem) { if (!sem) {
@ -316,7 +316,7 @@ static const SDL_sem_impl_t SDL_sem_impl_kern = {
&SDL_DestroySemaphore_kern, &SDL_DestroySemaphore_kern,
&SDL_WaitSemaphoreTimeoutNS_kern, &SDL_WaitSemaphoreTimeoutNS_kern,
&SDL_GetSemaphoreValue_kern, &SDL_GetSemaphoreValue_kern,
&SDL_PostSemaphore_kern, &SDL_SignalSemaphore_kern,
}; };
/** /**
@ -376,7 +376,7 @@ Uint32 SDL_GetSemaphoreValue(SDL_Semaphore *sem)
return SDL_sem_impl_active.Value(sem); return SDL_sem_impl_active.Value(sem);
} }
int SDL_PostSemaphore(SDL_Semaphore *sem) int SDL_SignalSemaphore(SDL_Semaphore *sem)
{ {
return SDL_sem_impl_active.Post(sem); return SDL_sem_impl_active.Post(sem);
} }

View file

@ -243,7 +243,7 @@ void SDL_QuitTimers(void)
if (SDL_AtomicCompareAndSwap(&data->active, 1, 0)) { /* active? Move to inactive. */ if (SDL_AtomicCompareAndSwap(&data->active, 1, 0)) { /* active? Move to inactive. */
/* Shutdown the timer thread */ /* Shutdown the timer thread */
if (data->thread) { if (data->thread) {
SDL_PostSemaphore(data->sem); SDL_SignalSemaphore(data->sem);
SDL_WaitThread(data->thread, NULL); SDL_WaitThread(data->thread, NULL);
data->thread = NULL; data->thread = NULL;
} }
@ -334,7 +334,7 @@ static SDL_TimerID SDL_CreateTimer(Uint64 interval, SDL_TimerCallback callback_m
SDL_UnlockSpinlock(&data->lock); SDL_UnlockSpinlock(&data->lock);
/* Wake up the timer thread if necessary */ /* Wake up the timer thread if necessary */
SDL_PostSemaphore(data->sem); SDL_SignalSemaphore(data->sem);
return entry->timerID; return entry->timerID;
} }

View file

@ -66,7 +66,7 @@ int EventUpdate(void *data)
while (running) { while (running) {
SDL_WaitSemaphore(event_sem); SDL_WaitSemaphore(event_sem);
sceHprmPeekCurrentKey((u32 *)&hprm); sceHprmPeekCurrentKey((u32 *)&hprm);
SDL_PostSemaphore(event_sem); SDL_SignalSemaphore(event_sem);
/* Delay 1/60th of a second */ /* Delay 1/60th of a second */
sceKernelDelayThread(1000000 / 60); sceKernelDelayThread(1000000 / 60);
} }
@ -82,7 +82,7 @@ void PSP_PumpEvents(SDL_VideoDevice *_this)
SDL_WaitSemaphore(event_sem); SDL_WaitSemaphore(event_sem);
keys = hprm; keys = hprm;
SDL_PostSemaphore(event_sem); SDL_SignalSemaphore(event_sem);
/* HPRM Keyboard */ /* HPRM Keyboard */
changed = old_keys ^ keys; changed = old_keys ^ keys;

View file

@ -121,7 +121,7 @@ static int SDLCALL adder(void *junk)
bad -= CountInc; bad -= CountInc;
} }
SDL_AtomicAdd(&threadsRunning, -1); SDL_AtomicAdd(&threadsRunning, -1);
SDL_PostSemaphore(threadDone); SDL_SignalSemaphore(threadDone);
return 0; return 0;
} }

View file

@ -609,7 +609,7 @@ loop_threaded(void)
tdata = GetThreadDataForWindow(event.window.windowID); tdata = GetThreadDataForWindow(event.window.windowID);
if (tdata) { if (tdata) {
if (SDL_AtomicSet(&tdata->suspended, WAIT_STATE_GO) == WAIT_STATE_WAITING_ON_SEM) { if (SDL_AtomicSet(&tdata->suspended, WAIT_STATE_GO) == WAIT_STATE_WAITING_ON_SEM) {
SDL_PostSemaphore(tdata->suspend_sem); SDL_SignalSemaphore(tdata->suspend_sem);
} }
} }
} else if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED) { } else if (event.type == SDL_EVENT_WINDOW_CLOSE_REQUESTED) {
@ -619,7 +619,7 @@ loop_threaded(void)
tdata->done = 1; tdata->done = 1;
if (tdata->thread) { if (tdata->thread) {
SDL_AtomicSet(&tdata->suspended, WAIT_STATE_GO); SDL_AtomicSet(&tdata->suspended, WAIT_STATE_GO);
SDL_PostSemaphore(tdata->suspend_sem); SDL_SignalSemaphore(tdata->suspend_sem);
SDL_WaitThread(tdata->thread, NULL); SDL_WaitThread(tdata->thread, NULL);
tdata->thread = NULL; tdata->thread = NULL;
SDL_DestroySemaphore(tdata->suspend_sem); SDL_DestroySemaphore(tdata->suspend_sem);

View file

@ -56,7 +56,7 @@ ThreadFuncRealWorld(void *data)
SDL_Log("Thread number %d has got the semaphore (value = %" SDL_PRIu32 ")!\n", SDL_Log("Thread number %d has got the semaphore (value = %" SDL_PRIu32 ")!\n",
state->number, SDL_GetSemaphoreValue(sem)); state->number, SDL_GetSemaphoreValue(sem));
SDL_Delay(200); SDL_Delay(200);
SDL_PostSemaphore(sem); SDL_SignalSemaphore(sem);
SDL_Log("Thread number %d has released the semaphore (value = %" SDL_PRIu32 ")!\n", SDL_Log("Thread number %d has released the semaphore (value = %" SDL_PRIu32 ")!\n",
state->number, SDL_GetSemaphoreValue(sem)); state->number, SDL_GetSemaphoreValue(sem));
++state->loop_count; ++state->loop_count;
@ -145,7 +145,7 @@ TestOverheadUncontended(void)
start_ticks = SDL_GetTicks(); start_ticks = SDL_GetTicks();
for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++) { for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++) {
for (j = 0; j < NUM_OVERHEAD_OPS; j++) { for (j = 0; j < NUM_OVERHEAD_OPS; j++) {
SDL_PostSemaphore(sem); SDL_SignalSemaphore(sem);
} }
for (j = 0; j < NUM_OVERHEAD_OPS; j++) { for (j = 0; j < NUM_OVERHEAD_OPS; j++) {
SDL_WaitSemaphore(sem); SDL_WaitSemaphore(sem);
@ -211,7 +211,7 @@ TestOverheadContended(SDL_bool try_wait)
start_ticks = SDL_GetTicks(); start_ticks = SDL_GetTicks();
for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++) { for (i = 0; i < NUM_OVERHEAD_OPS_MULT; i++) {
for (j = 0; j < NUM_OVERHEAD_OPS; j++) { for (j = 0; j < NUM_OVERHEAD_OPS; j++) {
SDL_PostSemaphore(sem); SDL_SignalSemaphore(sem);
} }
/* Make sure threads consumed everything */ /* Make sure threads consumed everything */
while (SDL_GetSemaphoreValue(sem)) { while (SDL_GetSemaphoreValue(sem)) {