Example #1
0
unsigned __stdcall DlThread::thread_routine(void *i_params)
{
#else
void* DlThread::thread_routine(void *i_params)
{
	pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0x0);
#endif
	DlThread *t = (DlThread*) i_params;

#ifdef _WIN32
	/* Set the same signal handlers as the parent. */
	for( unsigned i = 0; i < num_propagated_signals; ++i )
	{
		signal( propagated_signals[i], t->m_data->m_signal_handlers[i] );
	}
#endif

	s_thread_instance.Set(t);

	t->m_data->m_thread_func(t->m_data->m_thread_arg);
	
	t->Cleanup();

	/* If this is a detached thread, it is our job to delete the DlThread. */
	if( t->m_data->m_start_detached )
	{
		delete t;
	}

	return 0;
}
Example #2
0
/*
	Handler for cancellation while sleeping.
*/
void DlThread::SleepCancel(void *i_thread)
{
	DlThread *thread = (DlThread*) i_thread;

	thread->Cleanup();
}