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


C++ SDL_CondSignal函数代码示例

本文整理汇总了C++中SDL_CondSignal函数的典型用法代码示例。如果您正苦于以下问题:C++ SDL_CondSignal函数的具体用法?C++ SDL_CondSignal怎么用?C++ SDL_CondSignal使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SDL_CondSignal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: aout_flush_audio

static void aout_flush_audio(SDL_Aout *aout)
{
    SDL_Aout_Opaque *opaque = aout->opaque;
    SDL_LockMutex(opaque->wakeup_mutex);
    SDLTRACE("aout_flush_audio()");
    opaque->need_flush = 1;
    SDL_CondSignal(opaque->wakeup_cond);
    SDL_UnlockMutex(opaque->wakeup_mutex);
}
开发者ID:Daniel-999,项目名称:ijkplayer,代码行数:9,代码来源:ijksdl_aout_android_opensles.c

示例2: SDL_GetError

bool condition::notify_one()
{
	if(SDL_CondSignal(cond_) < 0) {
		std::cerr << "SDL_CondSignal: " << SDL_GetError() << "\n";
		return false;
	}

	return true;
}
开发者ID:gradonly,项目名称:frogatto,代码行数:9,代码来源:thread.cpp

示例3: SDL_GetError

bool condition::notify_one()
{
	if(SDL_CondSignal(cond_) < 0) {
		ERR_G << "SDL_CondSignal: " << SDL_GetError() << std::endl;
		return false;
	}

	return true;
}
开发者ID:Spoffy,项目名称:wesnoth,代码行数:9,代码来源:thread.cpp

示例4: FE_PushEvent

int FE_PushEvent(SDL_Event *ev) {
    SDL_LockMutex(eventLock);
    while (SDL_PushEvent(ev) == -1)
        SDL_CondWait(eventWait, eventLock);

    SDL_UnlockMutex(eventLock);
    SDL_CondSignal(eventWait);	/* ? wake thread Waiting for event */

    return 1;
}
开发者ID:radomik,项目名称:SDL_Widgets,代码行数:10,代码来源:FeFastEvents.c

示例5: client_socket_close

/**
 * Close a client socket.
 * @param csock
 * Socket to close.
 */
void client_socket_close(client_socket_t *csock)
{
    HARD_ASSERT(csock != NULL);

    SDL_LockMutex(socket_mutex);

    if (csock->sc != NULL) {
        socket_destroy(csock->sc);
        csock->sc = NULL;
    }

    abort_thread = 1;

    /* Poke anyone waiting at a cond */
    SDL_CondSignal(input_buffer_cond);
    SDL_CondSignal(output_buffer_cond);

    SDL_UnlockMutex(socket_mutex);
}
开发者ID:liwcezar,项目名称:atrinik,代码行数:24,代码来源:socket.c

示例6: SDL_mutexP

int ThreadPool::threadWrapper(void* param) {
	ThreadPoolItem* data = (ThreadPoolItem*)param;
	
	SDL_mutexP(data->pool->mutex);
	while(true) {
		while(data->pool->nextAction == NULL && !data->pool->quitting)
			SDL_CondWait(data->pool->awakeThread, data->pool->mutex);
		if(data->pool->quitting) break;
		data->pool->usedThreads.insert(data);
		data->pool->availableThreads.erase(data);
		
		Action* act = data->pool->nextAction; data->pool->nextAction = NULL;
		data->headless = data->pool->nextIsHeadless;
		data->name = data->pool->nextName;
		data->finished = false;
		data->working = true;
		data->pool->nextData = data;
		SDL_mutexV(data->pool->mutex);
		
		SDL_CondSignal(data->pool->threadStartedWork);
		g_pLogFile->textOut("Running Thread: " + data->name);
		data->ret = act->handle();
		delete act;
		g_pLogFile->textOut( data->name + " [finished]" );
		SDL_mutexP(data->pool->mutex);
		data->finished = true;
		SDL_CondSignal(data->pool->threadStatusChanged);
		
		if(!data->headless) { // headless means that we just can clean it up right now without waiting
			SDL_CondSignal(data->finishedSignal);
			while(data->working) SDL_CondWait(data->readyForNewWork, data->pool->mutex);
		} else
			data->working = false;
		data->pool->usedThreads.erase(data);
		data->pool->availableThreads.insert(data);
		SDL_CondSignal(data->pool->threadStatusChanged);
		//setCurThreadName("");
	}

	SDL_mutexV(data->pool->mutex);
		
	return 0;
}
开发者ID:Shayster,项目名称:Commander-Genius,代码行数:43,代码来源:ThreadPool.cpp

示例7: SDL_LockMutex

void JobQueue::Queue(Job *job)
{
	// push the job onto the queue
	SDL_LockMutex(m_queueLock);
	m_queue.push_back(job);
	SDL_UnlockMutex(m_queueLock);

	// and tell a waiting runner that there's one available
	SDL_CondSignal(m_queueWaitCond);
}
开发者ID:Loki999,项目名称:pioneer,代码行数:10,代码来源:JobQueue.cpp

示例8: packet_queue_abort

static void packet_queue_abort(PacketQueue *q)
{
    SDL_LockMutex(q->mutex);

    q->abort_request = 1;

    SDL_CondSignal(q->cond);

    SDL_UnlockMutex(q->mutex);
}
开发者ID:Abstak,项目名称:Mastermind_Python,代码行数:10,代码来源:ffmovie.c

示例9: frame_queue_next

static void frame_queue_next(FrameQueue *f)
{
	av_frame_unref(f->queue[f->rindex].frame);
	if (++f->rindex == f->max_size)
		f->rindex = 0;
	SDL_LockMutex(f->mutex);
	f->size--;
	SDL_CondSignal(f->cond);
	SDL_UnlockMutex(f->mutex);
}
开发者ID:shileiz,项目名称:notes,代码行数:10,代码来源:tutorial04_1.cpp

示例10: video_refresh_timer

/*
每次timer到时间会进来(timer到时间发 FF_REFRESH_EVENT,收到 FF_REFRESH_EVENT 会进来)
一个timer只进一次timer就失效了。不过本函数里面会再起一个timer。
从is->pictq拿出一个 VideoPicture 进行显示,然后pictq的读指针向前移动一步
*/
void video_refresh_timer(void *userdata) {

	VideoState *is = (VideoState *)userdata;
	VideoPicture *vp;
	double actual_delay, delay, sync_threshold, ref_clock, diff;

	if (is->video_st) {
		if (is->pictq_size == 0) {
			schedule_refresh(is, 1);
		}
		else {
			vp = &is->pictq[is->pictq_rindex];

			delay = vp->pts - is->frame_last_pts; /* the pts from last time */
			
			is->frame_last_pts = vp->pts;

			/* ----------- */
			/*音视频同步*/
			ref_clock = get_audio_clock(is);
			diff = vp->pts - ref_clock;
			if (diff <= -0.015) {
				delay = 0;
			}
			else if (diff >= 0.015) {
				delay = 2 * delay;
			}
			/* ----------- */


			if (delay == 0) {
				count_delay_is_zero++;
				delay = 0.010;
			}
			count_pict++;
			printf("delay==0 percentage is %lf",(double)count_delay_is_zero/count_pict);
			schedule_refresh(is, (int)(delay * 1000 + 0.5));

			/* show the picture! */
			video_display(is);

			/* update queue for next picture! */
			if (++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE) {
				is->pictq_rindex = 0;
			}
			SDL_LockMutex(is->pictq_mutex);
			is->pictq_size--;
			SDL_CondSignal(is->pictq_cond);
			SDL_UnlockMutex(is->pictq_mutex);
		}
	}
	else {
		schedule_refresh(is, 100);
	}
}
开发者ID:shileiz,项目名称:notes,代码行数:60,代码来源:tutorial05.cpp

示例11: SDL_mutexP

void SoundSDL::read(u16 * stream, int length)
{
  if (!_initialized || length <= 0 || !emulating)
    return;

  SDL_mutexP(_mutex);
  _rbuf.read(stream, std::min(static_cast<std::size_t>(length) / 2, _rbuf.used()));

  SDL_CondSignal(_cond);
  SDL_mutexV(_mutex);
}
开发者ID:jamesread,项目名称:vba-linux,代码行数:11,代码来源:SoundSDL.cpp

示例12: fifo_signal

int fifo_signal(struct fifo *fifo) {
	ASSERT_FIFO_LOCKED(fifo);

#if defined(HAVE_LIBPTHREAD) && !defined(SDL_FIFOS)
	/* linux multi-process locking */
	return pthread_cond_signal(&fifo->cond);
#else
	/* cross platform locking */
	return SDL_CondSignal(fifo->cond);
#endif
}
开发者ID:gnalbandian,项目名称:squeezeplay,代码行数:11,代码来源:fifo.c

示例13: DelayCallback

static void DelayCallback(void *_delay_data)
{
    delay_data_t *delay_data = _delay_data;

    SDL_LockMutex(delay_data->mutex);
    delay_data->finished = 1;

    SDL_CondSignal(delay_data->cond);

    SDL_UnlockMutex(delay_data->mutex);
}
开发者ID:DooMJunkie,项目名称:wii-doom-1,代码行数:11,代码来源:opl.c

示例14: aout_set_volume

static void aout_set_volume(SDL_Aout *aout, float left_volume, float right_volume)
{
    SDL_Aout_Opaque *opaque = aout->opaque;
    SDL_LockMutex(opaque->wakeup_mutex);
    SDLTRACE("aout_flush_audio()");
    opaque->left_volume = left_volume;
    opaque->right_volume = right_volume;
    opaque->need_set_volume = 1;
    SDL_CondSignal(opaque->wakeup_cond);
    SDL_UnlockMutex(opaque->wakeup_mutex);
}
开发者ID:eblislu,项目名称:ijkplayer,代码行数:11,代码来源:ijksdl_aout_android_audiotrack.c

示例15: aout_set_volume

static void aout_set_volume(SDL_Aout *aout, float left_volume, float right_volume)
{
    SDL_Aout_Opaque *opaque = aout->opaque;
    SDL_LockMutex(opaque->wakeup_mutex);
    ALOGI("aout_set_volume(%f, %f)", left_volume, right_volume);
    opaque->left_volume = left_volume;
    opaque->right_volume = right_volume;
    opaque->need_set_volume = 1;
    SDL_CondSignal(opaque->wakeup_cond);
    SDL_UnlockMutex(opaque->wakeup_mutex);
}
开发者ID:17media,项目名称:ijkplayer,代码行数:11,代码来源:ijksdl_aout_android_opensles.c


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