コード例 #1
0
// The kernel thread needs another stack to delete its own stack.
static void kthread_do_kill_thread(void* user)
{
	Thread* thread = (Thread*) user;
	while ( thread->state != ThreadState::DEAD )
		kthread_yield();
	FreeThread(thread);
}
コード例 #2
0
/*
================
idThread::PruneThreads
================
*/
void idThread::PruneThreads( void ) {
	idThread* next = NULL;
	for ( idThread* thread = threadList.Next(); thread; thread = next ) {
		next = thread->threadNode.Next();

		if ( thread->interpreter.terminateOnExit ) {
			FreeThread( thread );
			continue;
		}	
	}
}
コード例 #3
0
/*
================
idThread::Restart
================
*/
void idThread::Restart( void ) {
	// reset the threadIndex
	threadIndex = 0;

	currentThread = NULL;

	threadAllocator.Shutdown();

	while ( !threadList.IsListEmpty() ) {
		FreeThread( threadList.Next() );
	}
	threadNumList.Clear();

	memset( &trace, 0, sizeof( trace ) );
	trace.c.entityNum = ENTITYNUM_NONE;
}
コード例 #4
0
int32_t TThread::Start()
{	
    if (state_ == TS_RUNNING)
	{
		return 0;
	}
	if (nullptr!=p_handle_->h_thread)
	{
		FreeThread();
	}
	SetState(TS_UNINITIALIZED);
	uint32_t flag = 0;
	p_handle_->h_thread = (HANDLE)_beginthreadex(nullptr, 0, ThreadStart, this, flag, nullptr);
	if (nullptr == p_handle_->h_thread)
	{
		return -1;
	}
	SetState(TS_INITIALIZED);
    return 0;
}
コード例 #5
0
/*
================
idThread::Event_Remove
================
*/
void idThread::Event_Remove( void ) {
	OnEventRemove();
	FreeThread( this );
}
コード例 #6
0
TThread::~TThread(void)  
{
	FreeThread();
	delete p_handle_;
}