Ejemplo n.º 1
0
int main(int argc, char* argv[])
{
	assert(system(NULL));

	EasyThread* easyThread = new EasyThread();

	easyThread->setFunction(testFunction);
	easyThread->setArgument((void*)3000U);

	std::cout << "Is the thread active? " << (easyThread->isActive() ? "Yes, it is!" : "No, it's not.") << std::endl;

	easyThread->run();

	easyThread->setName("testFunction");

	std::cout << "Is the thread active now? " << (easyThread->isActive() ? "Yes, it is!" : "No, it's not.") << std::endl;

	// Wait until the thread ends.
	while (easyThread->isActive())
	{
		std::cout << "ayy lmao" << std::endl;
		EasyThread::sleep(1000);
	}

	delete easyThread;

	// More examples coming soon.

	return 0;
}
Ejemplo n.º 2
0
/*static */
void * EasyThread::entryPoint(void * pthis)
{
    EasyThread * pt = (EasyThread*) pthis;
    pt->run(pt->arg());
}