Esempio n. 1
0
void printThreadNumber(int threadNumber)
{
	int i = 0;
	for(i=threadNumber; i<40; i+=2)
	{
		printf("Thread %d imprimiu %d\n",threadNumber, i);
		uth_yield();
	}
}
Esempio n. 2
0
File: uth.c Progetto: mballance/uex
// Blocks the active thread
static void uth_thread_block(void) {
//	fprintf(stdout, "Block thread %p\n", prv_active_thread);
	prv_active_thread->status |= UTH_THREAD_STATUS_BLOCKED;

	uth_yield();

//	if ((prv_active_thread->status & UTH_THREAD_STATUS_BLOCKED)) {
//		fprintf(stdout, "Error: blocked thread returned\n");
//	}
}
Esempio n. 3
0
File: uth.c Progetto: mballance/uex
static void uth_thread_unblock(uth_thread_t *t) {
	t->status &= ~(UTH_THREAD_STATUS_BLOCKED);
//	fprintf(stdout, "Unblock thread %p\n", t);

	// Add this thread back to the active list
	t->next = prv_active_list;
	prv_active_list = t;

	// Allow the other thread to wake up
	uth_yield();
}