本文整理汇总了C++中ThreadHandle类的典型用法代码示例。如果您正苦于以下问题:C++ ThreadHandle类的具体用法?C++ ThreadHandle怎么用?C++ ThreadHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ThreadHandle类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TEST
TEST(IThread, Test1) {
class ThreadHandle: public IThread {
public:
ThreadHandle():num(1) {}
virtual ~ThreadHandle() {}
private:
public:
virtual void run() {
ASSERT_EQ(num, 1u);
num = 2;
}
public:
size_t num;
};
{
ThreadHandle thr;
thr.start();
thr.join();
ASSERT_EQ(thr.num, 2u);
}
{
IThread* ptr = new ThreadHandle();
ptr->start();
ptr->join();
delete ptr;
}
}
开发者ID:sunnyss12,项目名称:limonp,代码行数:27,代码来源:TThread.cpp
示例2: currentThread
bool
Thread::interrupted()
{
ThreadHandle handle = currentThread();
if(!handle.is_null()) {
return handle->consumeInterruptionSync();
} else {
return false;
}
};
开发者ID:AlvaroVega,项目名称:TIDorbC,代码行数:11,代码来源:Thread.C
示例3: VM_GetArgValues
OVUM_API size_t VM_GetArgValues(ThreadHandle thread, size_t destLength, Value dest[])
{
return thread->GetVM()->GetArgValues(destLength, dest);
}
开发者ID:osprey-lang,项目名称:ovum,代码行数:4,代码来源:vm.cpp
示例4: VM_GetArgs
OVUM_API size_t VM_GetArgs(ThreadHandle thread, size_t destLength, String *dest[])
{
return thread->GetVM()->GetArgs(destLength, dest);
}
开发者ID:osprey-lang,项目名称:ovum,代码行数:4,代码来源:vm.cpp
示例5: VM_GetArgCount
OVUM_API size_t VM_GetArgCount(ThreadHandle thread)
{
return thread->GetVM()->GetArgCount();
}
开发者ID:osprey-lang,项目名称:ovum,代码行数:4,代码来源:vm.cpp
示例6: IsLockedByCurrent
/**
* Determine if the current thread has locked this mutex. This is a
* debug-only method meant for assert() calls, and is not available
* in optimised builds.
*/
gcc_pure
bool IsLockedByCurrent() const {
debug_mutex.Lock();
bool result = locked && owner.IsInside();
debug_mutex.Unlock();
return result;
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:12,代码来源:Mutex.hpp
示例7: assert
void
LeaveDrawThread()
{
assert(InMainThread());
assert(draw_thread_handle.IsInside());
draw_thread_handle = zero_thread_handle;
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:8,代码来源:Components.cpp
示例8: InMainThread
bool
InDrawThread()
{
#ifdef ENABLE_OPENGL
return InMainThread() && draw_thread_handle.IsInside();
#else
return draw_thread != nullptr && draw_thread->IsInside();
#endif
}
开发者ID:XCSoar,项目名称:XCSoar,代码行数:9,代码来源:Components.cpp
示例9: Unlock
/**
* Unlocks the Mutex
*/
void Unlock() {
#ifndef NDEBUG
debug_mutex.lock();
assert(locked);
assert(owner.IsInside());
locked = false;
debug_mutex.unlock();
#endif
mutex.unlock();
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:14,代码来源:Mutex.hpp
示例10: Unlock
/**
* Unlocks the Mutex
*/
void Unlock() {
#ifndef NDEBUG
debug_mutex.Lock();
assert(locked);
assert(owner.IsInside());
locked = false;
debug_mutex.Unlock();
#endif
mutex.Unlock();
#ifndef NDEBUG
--thread_locks_held;
#endif
}
开发者ID:MindMil,项目名称:XCSoar,代码行数:18,代码来源:Mutex.hpp
示例11: WakeUp
void WakeUp() {
if (!thread.IsInside())
event_pipe.Signal();
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:4,代码来源:Queue.hpp
示例12: ClockUS
/**
* Returns the monotonic clock in microseconds. This method is only
* available in the main thread.
*/
gcc_pure
uint64_t ClockUS() const {
assert(thread.IsInside());
return now_us;
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:10,代码来源:Queue.hpp
示例13:
bool
InMainThread()
{
return main_thread.IsInside();
}
开发者ID:LK8000,项目名称:LK8000,代码行数:5,代码来源:Debug.cpp
注:本文中的ThreadHandle类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论