本文整理汇总了C++中cMutex类的典型用法代码示例。如果您正苦于以下问题:C++ cMutex类的具体用法?C++ cMutex怎么用?C++ cMutex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了cMutex类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getenv
void cDBusHelper::ToUtf8(cString &text)
{
if ((cCharSetConv::SystemCharacterTable() == NULL) || (strcmp(cCharSetConv::SystemCharacterTable(), "UTF-8") == 0)) {
if (!cDBusHelper::IsValidUtf8(*text)) {
static const char *fromCharSet = "ISO6937";
static const char *charSetOverride = getenv("VDR_CHARSET_OVERRIDE");
if (charSetOverride)
fromCharSet = charSetOverride;
d4syslog("dbus2vdr: ToUtf8: create charset converter from %s to UTF-8", fromCharSet);
static cCharSetConv converter(fromCharSet);
static cMutex mutex;
mutex.Lock();
text = converter.Convert(*text);
mutex.Unlock();
}
}
else {
d4syslog("dbus2vdr: ToUtf8: create charset converter to UTF-8");
static cCharSetConv converter(NULL, "UTF-8");
static cMutex mutex;
mutex.Lock();
text = converter.Convert(*text);
mutex.Unlock();
}
}
开发者ID:flensrocker,项目名称:vdr-plugin-dbus2vdr,代码行数:25,代码来源:helper.c
示例2: rend_framePending
bool rend_framePending() {
mtx_rqueue.Lock();
TA_context* rv = rqueue;
mtx_rqueue.Unlock();
return rv != 0;
}
开发者ID:kitrio,项目名称:reicast-emulator,代码行数:7,代码来源:ta_ctx.cpp
示例3: FinishRender
void FinishRender(TA_context* ctx)
{
verify(rqueue == ctx);
mtx_rqueue.Lock();
rqueue = 0;
mtx_rqueue.Unlock();
tactx_Recycle(ctx);
}
开发者ID:hean01,项目名称:reicast-emulator,代码行数:9,代码来源:ta_ctx.cpp
示例4: Switch
cDevice* cSwitchLive::Switch(cDevice *Device, const cChannel *Channel)
{
mutex.Lock();
device = Device;
channel = Channel;
mutex.Unlock();
switched.Wait();
return device;
}
开发者ID:FFTEAM,项目名称:evolux-spark-sh4,代码行数:9,代码来源:connection.c
示例5: SetPid
bool SCDEVICE::SetPid(cPidHandle *Handle, int Type, bool On)
{
DEBUGLOG("%s: on=%d", __FUNCTION__, On);
tsMutex.Lock();
if (tsBuffer)
tsBuffer->SetActive(ScActive());
tsMutex.Unlock();
return DVBDEVICE::SetPid(Handle, Type, On);
}
开发者ID:macmenot,项目名称:vdr-plugin-dvbapi,代码行数:9,代码来源:device-tmpl.cpp
示例6: DequeueRender
TA_context* DequeueRender()
{
mtx_rqueue.Lock();
TA_context* rv = rqueue;
mtx_rqueue.Unlock();
if (rv)
FrameCount++;
return rv;
}
开发者ID:hean01,项目名称:reicast-emulator,代码行数:11,代码来源:ta_ctx.cpp
示例7: CloseDvr
void SCDEVICE::CloseDvr(void)
{
DEBUGLOG("%s", __FUNCTION__);
tsMutex.Lock();
delete tsBuffer;
tsBuffer = 0;
tsMutex.Unlock();
if (fd_dvr >= 0)
{
close(fd_dvr);
fd_dvr = -1;
}
}
开发者ID:macmenot,项目名称:vdr-plugin-dvbapi,代码行数:13,代码来源:device-tmpl.cpp
示例8: OpenDvr
bool SCDEVICE::OpenDvr(void)
{
DEBUGLOG("%s", __FUNCTION__);
CloseDvr();
fd_dvr = cScDevices::DvbOpen(DEV_DVB_DVR, DVB_DEV_SPEC, O_RDONLY | O_NONBLOCK, true);
if (fd_dvr >= 0)
{
tsMutex.Lock();
tsBuffer = new DeCsaTsBuffer(fd_dvr, MEGABYTE(4), CardIndex() + 1, sCCIAdapter->GetDeCSA(), ScActive());
tsMutex.Unlock();
}
return fd_dvr >= 0;
}
开发者ID:macmenot,项目名称:vdr-plugin-dvbapi,代码行数:13,代码来源:device-tmpl.cpp
示例9: QueueRender
bool QueueRender(TA_context* ctx)
{
verify(ctx != 0);
if (FrameSkipping && frameskip) {
frameskip=1-frameskip;
tactx_Recycle(ctx);
fskip++;
return false;
}
//Try to limit speed to a "sane" level
//Speed is also limited via audio, but audio
//is sometimes not accurate enough (android, vista+)
u32 cycle_span = sh4_sched_now64() - last_cyces;
last_cyces = sh4_sched_now64();
double time_span = os_GetSeconds() - last_frame;
last_frame = os_GetSeconds();
bool too_fast = (cycle_span / time_span) > (SH4_MAIN_CLOCK * 1.2);
if (rqueue && too_fast && settings.pvr.SynchronousRender) {
//wait for a frame if
// we have another one queue'd and
// sh4 run at > 120% on the last slice
// and SynchronousRendering is enabled
frame_finished.Wait();
verify(!rqueue);
}
if (rqueue) {
tactx_Recycle(ctx);
fskip++;
return false;
}
frame_finished.Reset();
mtx_rqueue.Lock();
TA_context* old = rqueue;
rqueue=ctx;
mtx_rqueue.Unlock();
verify(!old);
return true;
}
开发者ID:kitrio,项目名称:reicast-emulator,代码行数:46,代码来源:ta_ctx.cpp
示例10: tactx_Recycle
void tactx_Recycle(TA_context* poped_ctx)
{
mtx_pool.Lock();
{
if (ctx_pool.size()>2)
{
poped_ctx->Free();
delete poped_ctx;
}
else
{
poped_ctx->Reset();
ctx_pool.push_back(poped_ctx);
}
}
mtx_pool.Unlock();
}
开发者ID:hean01,项目名称:reicast-emulator,代码行数:17,代码来源:ta_ctx.cpp
示例11: VramLockedWrite
bool VramLockedWrite(u8* address)
{
size_t offset=address-vram.data;
if (offset<VRAM_SIZE)
{
size_t addr_hash = offset/PAGE_SIZE;
vector<vram_block*>* list=&VramLocks[addr_hash];
{
vramlist_lock.Lock();
for (size_t i=0;i<list->size();i++)
{
if ((*list)[i])
{
libPvr_LockedBlockWrite((*list)[i],(u32)offset);
if ((*list)[i])
{
msgboxf("Error : pvr is supposed to remove lock",MBX_OK);
dbgbreak;
}
}
}
list->clear();
vram.UnLockRegion((u32)offset&(~(PAGE_SIZE-1)),PAGE_SIZE);
//TODO: Fix this for 32M wrap as well
if (_nvmem_enabled() && VRAM_SIZE == 0x800000) {
vram.UnLockRegion((u32)offset&(~(PAGE_SIZE-1)) + VRAM_SIZE,PAGE_SIZE);
}
vramlist_lock.Unlock();
}
return true;
}
else
return false;
}
开发者ID:KitoHo,项目名称:reicast-emulator,代码行数:44,代码来源:TexCache.cpp
示例12: QueueRender
bool QueueRender(TA_context* ctx)
{
verify(ctx != 0);
if (rqueue) {
tactx_Recycle(ctx);
fskip++;
return false;
}
mtx_rqueue.Lock();
TA_context* old = rqueue;
rqueue=ctx;
mtx_rqueue.Unlock();
verify(!old);
return true;
}
开发者ID:hean01,项目名称:reicast-emulator,代码行数:19,代码来源:ta_ctx.cpp
示例13: libCore_vramlock_Lock
vram_block* libCore_vramlock_Lock(u32 start_offset64,u32 end_offset64,void* userdata)
{
vram_block* block=(vram_block* )malloc(sizeof(vram_block));
if (end_offset64>(VRAM_SIZE-1))
{
msgboxf("vramlock_Lock_64: end_offset64>(VRAM_SIZE-1) \n Tried to lock area out of vram , possibly bug on the pvr plugin",MBX_OK);
end_offset64=(VRAM_SIZE-1);
}
if (start_offset64>end_offset64)
{
msgboxf("vramlock_Lock_64: start_offset64>end_offset64 \n Tried to lock negative block , possibly bug on the pvr plugin",MBX_OK);
start_offset64=0;
}
block->end=end_offset64;
block->start=start_offset64;
block->len=end_offset64-start_offset64+1;
block->userdata=userdata;
block->type=64;
{
vramlist_lock.Lock();
vram.LockRegion(block->start,block->len);
//TODO: Fix this for 32M wrap as well
if (_nvmem_enabled() && VRAM_SIZE == 0x800000) {
vram.LockRegion(block->start + VRAM_SIZE, block->len);
}
vramlock_list_add(block);
vramlist_lock.Unlock();
}
return block;
}
开发者ID:KitoHo,项目名称:reicast-emulator,代码行数:41,代码来源:TexCache.cpp
示例14: tactx_Alloc
TA_context* tactx_Alloc()
{
TA_context* rv = 0;
mtx_pool.Lock();
if (ctx_pool.size())
{
rv = ctx_pool[ctx_pool.size()-1];
ctx_pool.pop_back();
}
mtx_pool.Unlock();
if (!rv)
{
rv = new TA_context();
rv->Alloc();
printf("new tactx\n");
}
return rv;
}
开发者ID:hean01,项目名称:reicast-emulator,代码行数:21,代码来源:ta_ctx.cpp
示例15: LogStatsUp
void LogStatsUp(void)
{
logstatsMutex.Lock();
if(LOG(L_CORE_AUSTATS) && !logstats) logstats=new cLogStats;
logstatsMutex.Unlock();
}
开发者ID:attuska,项目名称:Sasc-ng,代码行数:6,代码来源:cam.c
示例16: LogStatsDown
void LogStatsDown(void)
{
logstatsMutex.Lock();
if(logstats) { delete logstats; logstats=0; }
logstatsMutex.Unlock();
}
开发者ID:attuska,项目名称:Sasc-ng,代码行数:6,代码来源:cam.c
示例17: libCore_vramlock_Unlock_block
//unlocks mem
//also frees the handle
void libCore_vramlock_Unlock_block(vram_block* block)
{
vramlist_lock.Lock();
libCore_vramlock_Unlock_block_wb(block);
vramlist_lock.Unlock();
}
开发者ID:KitoHo,项目名称:reicast-emulator,代码行数:8,代码来源:TexCache.cpp
注:本文中的cMutex类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论