本文整理汇总了C++中MutexUnlock函数的典型用法代码示例。如果您正苦于以下问题:C++ MutexUnlock函数的具体用法?C++ MutexUnlock怎么用?C++ MutexUnlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MutexUnlock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GBASyncUnlockAudio
void GBASyncUnlockAudio(struct GBASync* sync) {
if (!sync) {
return;
}
MutexUnlock(&sync->audioBufferMutex);
}
示例2: MutexUnlock
void UvdState::unlock()
{
if (m_isRealtimeMode)
{
MutexUnlock(&m_lock);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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 );
}
示例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;
}
示例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);
}
示例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;
}
示例10: GBASyncWaitFrameEnd
void GBASyncWaitFrameEnd(struct GBASync* sync) {
if (!sync) {
return;
}
MutexUnlock(&sync->videoFrameMutex);
}
示例11: MutexUnlock
void avtExecutionManager::MutexUnlock( const MUTEX_ID stringID )
{
if (tPool == NULL)
return;
MutexUnlock( FindMutex(stringID) );
}
示例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 );
}
示例13: KLogToScreenDisable
void KLogToScreenDisable(void)
{
MutexLock (&dbg_mutex);
klog_to_screen = FALSE;
MutexUnlock (&dbg_mutex);
}
示例14: GBASyncConsumeAudio
void GBASyncConsumeAudio(struct GBASync* sync) {
if (!sync) {
return;
}
ConditionWake(&sync->audioRequiredCond);
MutexUnlock(&sync->audioBufferMutex);
}
示例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;
}