void * TaskScheduler::thread_func(void * arg)
{
    boost::shared_ptr<ThreadParameters> tp = *(boost::shared_ptr<ThreadParameters>*)arg;
	TaskScheduler *that = tp->that;
	pthread_cleanup_push(cleanitup,&tp);
	that->runTask(tp);
	pthread_cleanup_pop(1);
	return NULL;
}