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


C++ MutexUnlock函数代码示例

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


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

示例1: GBASyncUnlockAudio

void GBASyncUnlockAudio(struct GBASync* sync) {
	if (!sync) {
		return;
	}

	MutexUnlock(&sync->audioBufferMutex);
}
开发者ID:netux79,项目名称:mgba,代码行数:7,代码来源:sync.c

示例2: MutexUnlock

void UvdState::unlock()
{
    if (m_isRealtimeMode)
    {
        MutexUnlock(&m_lock);
    }
}
开发者ID:rcg17,项目名称:uvdg-cocoa,代码行数:7,代码来源:UvdState.cpp

示例3: UsersDestroy

////////////////////////////////////////////////////////////
/// Destroy all users
////////////////////////////////////////////////////////////
bool UsersDestroy()
{
	struct UserData * Iterator = UserList.First;

	// Remove all users
	while (Iterator != NULL)
	{
		struct UserData * TempUser = Iterator;
		
		Iterator = Iterator->Next;

		// Close the socket
		MutexLock(&TempUser->MutexData);
		
		SocketClose(&TempUser->Connection.Socket);

		MutexUnlock(&TempUser->MutexData);

		// Destroy the mutex
		MutexDestroy(&TempUser->MutexData);

		// Free it
		free(TempUser);

		TempUser = NULL;
	}

	return true;
}
开发者ID:jordanfin,项目名称:aoc,代码行数:32,代码来源:Users.c

示例4: HeapAllocate

void* HeapAllocate(MemAllocHeap* heap, size_t size)
{
  bool thread_safe = 0 != (heap->m_Flags & HeapFlags::kThreadSafe);

  if (thread_safe)
  {
    MutexLock(&heap->m_Lock);
  }

  void* ptr = nullptr;
#if ENABLED(USE_DLMALLOC)
  ptr = mspace_malloc(heap->m_MemSpace, size);
#else
  ptr = malloc(size);
#endif
  if (!ptr)
  {
    Croak("out of memory allocating %d bytes", (int) size);
  }

  if (thread_safe)
  {
    MutexUnlock(&heap->m_Lock);
  }

  return ptr;
}
开发者ID:MadFishTheOne,项目名称:tundra,代码行数:27,代码来源:MemAllocHeap.cpp

示例5: HeapReallocate

void* HeapReallocate(MemAllocHeap *heap, void *ptr, size_t size)
{
  bool thread_safe = 0 != (heap->m_Flags & HeapFlags::kThreadSafe);

  if (thread_safe)
  {
    MutexLock(&heap->m_Lock);
  }

  void *new_ptr;
#if ENABLED(USE_DLMALLOC)
  new_ptr = mspace_realloc(heap->m_MemSpace, ptr, size);
#else
  new_ptr = realloc(ptr, size);
#endif
  if (!new_ptr && size > 0)
  {
    Croak("out of memory reallocating %d bytes at %p", (int) size, ptr);
  }

  if (thread_safe)
  {
    MutexUnlock(&heap->m_Lock);
  }

  return new_ptr;
}
开发者ID:MadFishTheOne,项目名称:tundra,代码行数:27,代码来源:MemAllocHeap.cpp

示例6: MutexLock

MUTEX * avtExecutionManager::FindMutex( const MUTEX_ID id )
{
    if (tPool == NULL)
        return NULL;

    std::map<MUTEX_ID, MUTEX *>::iterator it;
    MUTEX *lock;

    MutexLock( &mutexMapLock );

    it = mutexMap.find( id );
    if( it == mutexMap.end() )
    {
        // Not found, create it.
        lock = new MUTEX;
        MutexInit( lock );

        mutexMap.insert( std::pair<MUTEX_ID, MUTEX *>(id, lock) );
    }
    else
    {
        lock = it->second;
    }

    MutexUnlock( &mutexMapLock );

    return( lock );
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:28,代码来源:avtExecutionManager.C

示例7: MQTTDisconnect

int MQTTDisconnect(MQTTClient *c)
{
    int rc = FAILURE;
    Timer timer;     // we might wait for incomplete incoming publishes to complete
    int len = 0;

#if defined(MQTT_TASK)
    MutexLock(&c->mutex);
#endif
    TimerInit(&timer);
    TimerCountdownMS(&timer, c->command_timeout_ms);

    len = MQTTSerialize_disconnect(c->buf, c->buf_size);

    if (len > 0) {
        rc = sendPacket(c, len, &timer);    // send the disconnect packet
    }

    MQTTCloseSession(c);

#if defined(MQTT_TASK)
    MutexUnlock(&c->mutex);
#endif
    return rc;
}
开发者ID:espressif,项目名称:ESP8266_RTOS_SDK,代码行数:25,代码来源:MQTTClient.c

示例8: BuildQueueDestroy

  void BuildQueueDestroy(BuildQueue* queue)
  {
    Log(kDebug, "destroying build queue");
    const BuildQueueConfig* config = &queue->m_Config;

    MutexLock(&queue->m_Lock);
    queue->m_QuitSignalled = true;
    MutexUnlock(&queue->m_Lock);

    CondBroadcast(&queue->m_WorkAvailable);

    for (int i = 0, thread_count = config->m_ThreadCount; i < thread_count; ++i)
    {
      if (i > 0)
      {
        Log(kDebug, "joining with build thread %d", i);
        ThreadJoin(queue->m_Threads[i]);
      }

      ThreadStateDestroy(&queue->m_ThreadState[i]);
    }

    // Deallocate storage.
    MemAllocHeap* heap = queue->m_Config.m_Heap;
    HeapFree(heap, queue->m_ExpensiveWaitList);
    HeapFree(heap, queue->m_Queue);

    CondDestroy(&queue->m_WorkAvailable);
    MutexDestroy(&queue->m_Lock);

    // Unblock all signals on the main thread.
    SignalHandlerSetCondition(nullptr);
    SignalBlockThread(false);
  }
开发者ID:MadFishTheOne,项目名称:tundra,代码行数:34,代码来源:BuildQueue.cpp

示例9: _audioThread

static THREAD_ENTRY _audioThread(void* context) {
	struct mPSP2AudioContext* audio = (struct mPSP2AudioContext*) context;
	uint32_t zeroBuffer[PSP2_SAMPLES] = {0};
	void* buffer = zeroBuffer;
	int audioPort = sceAudioOutOpenPort(SCE_AUDIO_OUT_PORT_TYPE_MAIN, PSP2_SAMPLES, 48000, SCE_AUDIO_OUT_MODE_STEREO);
	while (audio->running) {
		MutexLock(&audio->mutex);
		if (buffer != zeroBuffer) {
			// Can only happen in successive iterations
			audio->samples -= PSP2_SAMPLES;
			ConditionWake(&audio->cond);
		}
		if (audio->samples >= PSP2_SAMPLES) {
			buffer = &audio->buffer[audio->readOffset];
			audio->readOffset += PSP2_SAMPLES;
			if (audio->readOffset >= PSP2_AUDIO_BUFFER_SIZE) {
				audio->readOffset = 0;
			}
			// Don't mark samples as read until the next loop iteration to prevent
			// writing to the buffer while being read (see above)
		} else {
			buffer = zeroBuffer;
		}
		MutexUnlock(&audio->mutex);

		sceAudioOutOutput(audioPort, buffer);
	}
	sceAudioOutReleasePort(audioPort);
	return 0;
}
开发者ID:leiradel,项目名称:mgba,代码行数:30,代码来源:psp2-context.c

示例10: GBASyncWaitFrameEnd

void GBASyncWaitFrameEnd(struct GBASync* sync) {
	if (!sync) {
		return;
	}

	MutexUnlock(&sync->videoFrameMutex);
}
开发者ID:netux79,项目名称:mgba,代码行数:7,代码来源:sync.c

示例11: MutexUnlock

void avtExecutionManager::MutexUnlock( const MUTEX_ID stringID )
{
    if (tPool == NULL)
        return;

    MutexUnlock( FindMutex(stringID) );
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:7,代码来源:avtExecutionManager.C

示例12: rwl_writer_stop

/**
 *	Call this function when a writer task finished using data that is
 *	protected by the given rwlock.
 */
void
rwl_writer_stop( TRWLock *rwlock )
{
	rwlock->wcount--;
        rwlock->wflag = 0;
        MutexUnlock( rwlock->datalock );
}
开发者ID:LiberatorUSA,项目名称:GUCEF,代码行数:11,代码来源:gucefMT_DVRWLOCK.c

示例13: KLogToScreenDisable

void KLogToScreenDisable(void)
{
	MutexLock (&dbg_mutex);

	klog_to_screen = FALSE;

	MutexUnlock (&dbg_mutex);
}
开发者ID:cod5,项目名称:kielder,代码行数:8,代码来源:kprintf.c

示例14: GBASyncConsumeAudio

void GBASyncConsumeAudio(struct GBASync* sync) {
	if (!sync) {
		return;
	}

	ConditionWake(&sync->audioRequiredCond);
	MutexUnlock(&sync->audioBufferMutex);
}
开发者ID:netux79,项目名称:mgba,代码行数:8,代码来源:sync.c

示例15: GBASIOLockstepNodeUnload

bool GBASIOLockstepNodeUnload(struct GBASIODriver* driver) {
    struct GBASIOLockstepNode* node = (struct GBASIOLockstepNode*) driver;
    MutexLock(&node->p->mutex);
    --node->p->loaded;
    ConditionWake(&node->p->barrier);
    MutexUnlock(&node->p->mutex);
    return true;
}
开发者ID:joolswills,项目名称:mgba,代码行数:8,代码来源:lockstep.c


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