#include <v_lib.h>

void V_CALL entry(void *arg)
{
	u8_t alpha;
	alpha=imgDefaultAlpha(0x80);
	timeDelay(20);
	logUpperLevel(LOG_TRACE);
	conlPrintf(LOG_INFO,"Thread2 started, arg %X.\n",arg);
	conPrintf("THREAD2: alpha was %X, now %X\n",alpha,imgDefaultAlpha(0x80));
	timeDelay(400);
	threadExit(0);
}

int main(void)
{
	u8_t alpha=0;
	thread_t second;
	logStartConsoleLog();
	alpha=imgDefaultAlpha(0x10);
	conlPrintf(LOG_INFO,"Starting Thread2 ...\n"); /* will not be printed */
	second=threadCreate(entry,NULL);
	timeDelay(10);
	conPrintf("alpha was %X, now %X\n",alpha,imgDefaultAlpha(0x10));
	threadJoin(second,NULL);
	conlPrintf(LOG_INFO,"Thread2 exited\n"); /* will be printed */
	conPrintf("alpha now %X\n",imgDefaultAlpha(0));
	return 0;
}
