Exemplo n.º 1
0
void* Thread::StartThreadStaticWrapperRun(void* pThread)
{
	LOGEX(Thread, LOG_VERBOSE, "Going to start thread main (Run method)");

    Thread *tThreadObject = (Thread*)pThread;
    void* tResult = tThreadObject->Run(tThreadObject->mThreadArguments);
    LOGEX(Thread, LOG_VERBOSE, "Thread finished (Run method)");
    tThreadObject->Init();
    return tResult;
}
Exemplo n.º 2
0
int main(int argc, char** argv)
{
	const int N = 1;
	for (int i = 0; i < N; ++i)
	{
		Thread thread;
		thread.Init();
		thread.Start(func, NULL);		
	} 	
	while(1)
	{
		sleep(1);
	}
	return 0;
}
Exemplo n.º 3
0
status_t
Team::AddThread(const ThreadInfo& threadInfo, Thread** _thread)
{
	Thread* thread = new(std::nothrow) Thread(this, threadInfo.ThreadID());
	if (thread == NULL)
		return B_NO_MEMORY;

	status_t error = thread->Init();
	if (error != B_OK) {
		delete thread;
		return error;
	}

	thread->SetName(threadInfo.Name());
	AddThread(thread);

	if (_thread != NULL)
		*_thread = thread;

	return B_OK;
}