本文整理汇总了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;
}
}
示例2: currentThread
bool
Thread::interrupted()
{
ThreadHandle handle = currentThread();
if(!handle.is_null()) {
return handle->consumeInterruptionSync();
} else {
return false;
}
};
示例3: VM_GetArgValues
OVUM_API size_t VM_GetArgValues(ThreadHandle thread, size_t destLength, Value dest[])
{
return thread->GetVM()->GetArgValues(destLength, dest);
}
示例4: VM_GetArgs
OVUM_API size_t VM_GetArgs(ThreadHandle thread, size_t destLength, String *dest[])
{
return thread->GetVM()->GetArgs(destLength, dest);
}
示例5: VM_GetArgCount
OVUM_API size_t VM_GetArgCount(ThreadHandle thread)
{
return thread->GetVM()->GetArgCount();
}
示例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;
}
示例7: assert
void
LeaveDrawThread()
{
assert(InMainThread());
assert(draw_thread_handle.IsInside());
draw_thread_handle = zero_thread_handle;
}
示例8: InMainThread
bool
InDrawThread()
{
#ifdef ENABLE_OPENGL
return InMainThread() && draw_thread_handle.IsInside();
#else
return draw_thread != nullptr && draw_thread->IsInside();
#endif
}
示例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();
}
示例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
}
示例11: WakeUp
void WakeUp() {
if (!thread.IsInside())
event_pipe.Signal();
}
示例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;
}
示例13:
bool
InMainThread()
{
return main_thread.IsInside();
}