本文整理汇总了C++中SDL_DestroySemaphore函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_DestroySemaphore函数的具体用法?C++ SDL_DestroySemaphore怎么用?C++ SDL_DestroySemaphore使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SDL_DestroySemaphore函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SDL_mutexP
SoundSDL::~SoundSDL()
{
if (!_initialized)
return;
#if !JS
SDL_mutexP(_mutex);
#endif
int iSave = emulating;
emulating = 0;
#if !JS
SDL_SemPost(_semBufferFull);
SDL_SemPost(_semBufferEmpty);
SDL_mutexV(_mutex);
SDL_DestroySemaphore(_semBufferFull);
SDL_DestroySemaphore(_semBufferEmpty);
#endif
_semBufferFull = NULL;
_semBufferEmpty = NULL;
SDL_DestroyMutex(_mutex);
_mutex = NULL;
SDL_CloseAudio();
emulating = iSave;
}
示例2: SDL_mutexP
SoundSDL::~SoundSDL()
{
if (!_initialized)
return;
SDL_mutexP(_mutex);
int iSave = emulating;
emulating = 0;
SDL_SemPost(_semBufferFull);
SDL_SemPost(_semBufferEmpty);
SDL_mutexV(_mutex);
SDL_DestroySemaphore(_semBufferFull);
SDL_DestroySemaphore(_semBufferEmpty);
_semBufferFull = NULL;
_semBufferEmpty = NULL;
SDL_DestroyMutex(_mutex);
_mutex = NULL;
SDL_CloseAudioDevice(_dev);
emulating = iSave;
_initialized = false;
}
示例3: Android_DestroyWindow
void
Android_DestroyWindow(_THIS, SDL_Window * window)
{
SDL_WindowData *data;
if (window == Android_Window) {
Android_Window = NULL;
if (Android_PauseSem) SDL_DestroySemaphore(Android_PauseSem);
if (Android_ResumeSem) SDL_DestroySemaphore(Android_ResumeSem);
Android_PauseSem = NULL;
Android_ResumeSem = NULL;
if(window->driverdata) {
data = (SDL_WindowData *) window->driverdata;
if (data->egl_surface != EGL_NO_SURFACE) {
SDL_EGL_DestroySurface(_this, data->egl_surface);
}
if (data->native_window) {
ANativeWindow_release(data->native_window);
}
SDL_free(window->driverdata);
window->driverdata = NULL;
}
}
}
示例4: vid_close
t_stat vid_close (void)
{
SDL_Event user_event;
int status;
if (vid_active) {
vid_active = FALSE;
if (vid_thread_handle) {
sim_debug (SIM_VID_DBG_VIDEO|SIM_VID_DBG_KEY|SIM_VID_DBG_MOUSE, vid_dev, "vid_close()\n");
user_event.type = SDL_USEREVENT;
user_event.user.code = EVENT_CLOSE;
user_event.user.data1 = NULL;
user_event.user.data2 = NULL;
SDL_PushEvent (&user_event);
SDL_WaitThread (vid_thread_handle, &status);
vid_thread_handle = NULL;
vid_dev = NULL;
}
if (vid_mouse_events.sem) {
SDL_DestroySemaphore(vid_mouse_events.sem);
vid_mouse_events.sem = NULL;
}
if (vid_key_events.sem) {
SDL_DestroySemaphore(vid_key_events.sem);
vid_key_events.sem = NULL;
}
}
return SCPE_OK;
}
示例5: main
int main(int argc, char** argv){
if(!argv[1]){
puts("No IP input found. Please initiate in the form ' ./Player <Server IP> '");
exit(1);
}
//fgets from stdin to get clientname (and pass that into run, ezpz)
printf("Please enter your name: ");
fgets(clientname, 64, stdin);
clientname[strlen(clientname) - 1] = '\0';
printf("Hello %s!\n", clientname);
strcat(clientname, " : ");
namelen = strlen(clientname);
///
SDL_Surface* screen = initScreen();
//Initiate the semaphores and chatserver thread
msgbuf_sem = SDL_CreateSemaphore(1);
textSem = SDL_CreateSemaphore(1);
chatserv = SDL_CreateThread(chatserver, screen);
//Initiate the server connection
int socket_id = server_setup(argv[1]);
//Initiate the client's sprite
Uint32 colorkey = SDL_MapRGB( screen->format, 255, 255, 255);
initiate(socket_id, colorkey);
TTF_Init();
run(screen, socket_id);
//CEASE AND DESIST
SDL_KillThread(chatserv);
SDL_FreeSurface(screen);
SDL_Quit();
TTF_Quit();
int i;
for(i=0; i<numMessages; i++)
if(text[i] != NULL)
SDL_FreeSurface(text[i]);
SDL_DestroySemaphore(msgbuf_sem);
SDL_DestroySemaphore(textSem);
return 1;
}
示例6: SDL_DestroyBarrier
void SDL_DestroyBarrier(SDL_barrier *b) {
if (b == NULL)
return;
SDL_DestroyMutex(b->mutex);
SDL_DestroySemaphore(b->turnstile);
SDL_DestroySemaphore(b->turnstile2);
free(b);
}
示例7: AudioQueue_DESTROY
void AudioQueue_DESTROY (AudioQueue* self)
{
AudioQueue_destroy_buffers(self);
Free(self->nodes);
self->nodes = NULL;
self->n = 0;
SDL_DestroySemaphore(self->empty_node);
SDL_DestroySemaphore(self->full_node);
self->empty_node = self->full_node = NULL;
}
示例8: system_sound_shutdown
void
system_sound_shutdown(void)
{
SDL_SemPost(rsem);
SDL_CloseAudio();
SDL_DestroySemaphore(rsem);
SDL_DestroySemaphore(wsem);
free(sound_buffer);
sound_buffer = NULL;
return;
}
示例9: SDL_DestroyCond
/* Destroy a condition variable */
DECLSPEC void SDLCALL SDL_DestroyCond(SDL_cond *cond)
{
if ( cond ) {
if ( cond->wait_sem ) {
SDL_DestroySemaphore(cond->wait_sem);
}
if ( cond->wait_done ) {
SDL_DestroySemaphore(cond->wait_done);
}
if ( cond->lock ) {
SDL_DestroyMutex(cond->lock);
}
SDL_free(cond);
}
}
示例10: SDL_DestroySemaphore
Case::~Case()
{
delete pAnimationManager;
pAnimationManager = NULL;
delete pAudioManager;
pAudioManager = NULL;
delete pContentManager;
pContentManager = NULL;
delete pDialogCharacterManager;
pDialogCharacterManager = NULL;
delete pDialogCutsceneManager;
pDialogCutsceneManager = NULL;
delete pEvidenceManager;
pEvidenceManager = NULL;
delete pFieldCharacterManager;
pFieldCharacterManager = NULL;
delete pFieldCutsceneManager;
pFieldCutsceneManager = NULL;
delete pFlagManager;
pFlagManager = NULL;
delete pPartnerManager;
pPartnerManager = NULL;
delete pSpriteManager;
pSpriteManager = NULL;
SDL_DestroySemaphore(pLoadStageSemaphore);
pLoadStageSemaphore = NULL;
}
示例11: ThreadHelper
static int
ThreadHelper (void *startInfo) {
ThreadFunction func;
void *data;
SDL_sem *sem;
TrueThread thread;
int result;
func = ((struct ThreadStartInfo *) startInfo)->func;
data = ((struct ThreadStartInfo *) startInfo)->data;
sem = ((struct ThreadStartInfo *) startInfo)->sem;
// Wait until the Thread structure is available.
SDL_SemWait (sem);
SDL_DestroySemaphore (sem);
thread = ((struct ThreadStartInfo *) startInfo)->thread;
HFree (startInfo);
result = (*func) (data);
#ifdef DEBUG_THREADS
log_add (log_Debug, "Thread '%s' done (returned %d).",
thread->name, result);
fflush (stderr);
#endif
UnQueueThread (thread);
DestroyThreadLocal (thread->localData);
FinishThread (thread);
/* Destroying the thread is the responsibility of ProcessThreadLifecycles() */
return result;
}
示例12: SDL_glue_SDL_CloseAudio
LISPBUILDERSDLGLUE_API void SDLCALL SDL_glue_SDL_CloseAudio(void) {
/* Seems this sequence of calls is quite important, or the glue-library will hang.
1) Bump the semaphore in case the callback is waiting on audio data.
2) Lock the callback. In effect returns when the callback returns.
Also makes sure that the callback cannot be called again before we hav a chance to
close the audio device. */
SDL_SemPost(audio_buffer_lock);
SDL_LockAudio();
if (audio_buffer_lock != NULL) {
SDL_DestroySemaphore(audio_buffer_lock);
audio_buffer_lock = NULL;
}
if (buffer_fill_lock != NULL) {
SDL_DestroyMutex(buffer_fill_lock);
buffer_fill_lock = NULL;
}
/* It is very likely that the audio buffer will be a different size the next time the audio device is opened
(assuming different input parameters. */
if (audio_buffer != NULL) {
free(audio_buffer);
audio_buffer = NULL;
}
SDL_CloseAudio();
}
示例13: system_init
void system_init(void)
{
SDL_sem *s;
/* fake stack, OS manages size (and growth) */
stackbegin = stackend = (uintptr_t*)&s;
#if (CONFIG_PLATFORM & PLATFORM_MAEMO)
/* Make glib thread safe */
g_thread_init(NULL);
g_type_init();
#endif
if (SDL_Init(SDL_INIT_TIMER))
panicf("%s", SDL_GetError());
s = SDL_CreateSemaphore(0); /* 0-count so it blocks */
evt_thread = SDL_CreateThread(sdl_event_thread, s);
/* wait for sdl_event_thread to run so that it can initialize the surfaces
* and video subsystem needed for SDL events */
SDL_SemWait(s);
/* cleanup */
SDL_DestroySemaphore(s);
}
示例14: XAUDIO2_CloseDevice
static void
XAUDIO2_CloseDevice(_THIS)
{
if (this->hidden != NULL) {
IXAudio2 *ixa2 = this->hidden->ixa2;
IXAudio2SourceVoice *source = this->hidden->source;
IXAudio2MasteringVoice *mastering = this->hidden->mastering;
if (source != NULL) {
IXAudio2SourceVoice_Stop(source, 0, XAUDIO2_COMMIT_NOW);
IXAudio2SourceVoice_FlushSourceBuffers(source);
IXAudio2SourceVoice_DestroyVoice(source);
}
if (ixa2 != NULL) {
IXAudio2_StopEngine(ixa2);
}
if (mastering != NULL) {
IXAudio2MasteringVoice_DestroyVoice(mastering);
}
if (ixa2 != NULL) {
IXAudio2_Release(ixa2);
}
SDL_free(this->hidden->mixbuf);
if (this->hidden->semaphore != NULL) {
SDL_DestroySemaphore(this->hidden->semaphore);
}
SDL_free(this->hidden);
this->hidden = NULL;
}
}
示例15: SDL_SYS_JoystickQuit
/* Function to perform any system-specific joystick related cleanup */
void SDL_SYS_JoystickQuit(void)
{
/* Cleanup Threads and Semaphore. */
running = 0;
SDL_WaitThread(thread, NULL);
SDL_DestroySemaphore(pad_sem);
}