当前位置: 首页>>代码示例>>C++>>正文


C++ SDL_DestroySemaphore函数代码示例

本文整理汇总了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;
}
开发者ID:akerl,项目名称:demos,代码行数:28,代码来源:SoundSDL.cpp

示例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;
}
开发者ID:ElementW,项目名称:visualboyadvance-m,代码行数:26,代码来源:SoundSDL.cpp

示例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;
        }
    }
}
开发者ID:jfiguinha,项目名称:Regards,代码行数:25,代码来源:SDL_androidwindow.c

示例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;
}
开发者ID:charlesUnixPro,项目名称:dps8m,代码行数:30,代码来源:sim_video.c

示例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;
}
开发者ID:kyeah,项目名称:VizChat,代码行数:59,代码来源:player_space.c

示例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);
}
开发者ID:pgoodman,项目名称:ece1747,代码行数:8,代码来源:SDL_barrier.cpp

示例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;
}
开发者ID:Blaizer,项目名称:Neverhood,代码行数:10,代码来源:Audio.c

示例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;
}
开发者ID:Cpasjuste,项目名称:neopop-sdl,代码行数:12,代码来源:system_sound.c

示例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);
	}
}
开发者ID:0-14N,项目名称:NDroid,代码行数:16,代码来源:SDL_syscond.c

示例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;
}
开发者ID:Jiray,项目名称:my-little-investigations,代码行数:28,代码来源:Case.cpp

示例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;
}
开发者ID:0xDEC0DE,项目名称:uqm-0.6.4-ee,代码行数:32,代码来源:sdlthreads.c

示例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();
}
开发者ID:Fizzixnerd,项目名称:home-scripts,代码行数:25,代码来源:lispbuilder-sdl-glue.c

示例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);
}
开发者ID:Brandon7357,项目名称:rockbox,代码行数:25,代码来源:system-sdl.c

示例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;
    }
}
开发者ID:Distrotech,项目名称:SDL,代码行数:31,代码来源:SDL_xaudio2.c

示例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);
}
开发者ID:BraveSirAndrew,项目名称:SDL2,代码行数:8,代码来源:SDL_sysjoystick.c


注:本文中的SDL_DestroySemaphore函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。