예제 #1
0
void _l4threads_suspendall_c(void)
{
  l4_msgdope_t result;
  if (sleepcount == leaflet.threadCount)
  {
    {
	  l4_ipc_send(leaflet.gc,
              L4_IPC_SHORT_MSG,
              0, //l4_umword_t  	  snd_dword0,
              0, //l4_umword_t  	  snd_dword1,
	      L4_IPC_NEVER,
              &result);
    } while (L4_IPC_ERROR(result) == L4_IPC_SECANCELED ||
             L4_IPC_ERROR(result) == L4_IPC_SEABORTED);
  }
  while (1) l4thread_sleep_forever();
} 
예제 #2
0
파일: main.c 프로젝트: RajasekharBhumi/L4Re
int main(int argc, char **argv) {
	int i;
	int prio=0;
	struct task *tqtask; 
	struct taskqueue *tq;

	ddekit_init();
	bsd_dde_init();

	tq = taskqueue_thread;
//	tq = taskqueue_swi;

	tqtask = malloc(sizeof(*tqtask), M_TST, M_ZERO|M_WAITOK);
	bzero(tqtask, sizeof(*tqtask));
	TASK_INIT(tqtask, prio, tqfn, (void*) prio);
	printf("enqueueing 10 tasks, step by step\n");
	for (i=1; i<=10; i++) {
		taskqueue_enqueue(tq, tqtask);
		l4thread_sleep(35);
	}

	l4thread_sleep(2000);
	printf("all enqueued tasks should be done now. testing now with prio's\n");

	for (i=1; i<=10; i++) {
		prio = (2*(i%2)-1) * i + 10;
		printf("enqueueing task with prio=%d\n", prio);

		tqtask = malloc(sizeof(*tqtask), M_TST, M_ZERO|M_WAITOK);
		bzero(tqtask, sizeof(*tqtask));
		TASK_INIT(tqtask, prio, tqfn, (void*) prio);

		taskqueue_enqueue(tq, tqtask);
		l4thread_sleep(35);
	}

	l4thread_sleep_forever();
	return 0;
}
예제 #3
0
파일: main.c 프로젝트: RajasekharBhumi/L4Re
int main(int argc, char **argv) {
	ddekit_init();
	bsd_dde_init();

	printf("cold=%d\n", cold);

	mtx_init(&mtx1, "test mutex", "test", MTX_DEF);
	cv_init(&cv1, "test condvar");

	printf("----------------------------------------\n");

	printf("wait for timeout\n");
	l4thread_create(cond, (void*) 1, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(200);

	printf("----------------------------------------\n");

	printf("calling signal too early\n");
	cv_signal(&cv1);
	l4thread_create(cond, (void*) 2, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(200);

	printf("----------------------------------------\n");

	printf("calling broadcast too early\n");
	cv_broadcast(&cv1);
	l4thread_create(cond, (void*) 3, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(200);

	printf("----------------------------------------\n");

	printf("waking up one of two threads by signal\n");
	l4thread_create(cond, (void*) 4, L4THREAD_CREATE_ASYNC);
	l4thread_create(cond, (void*) 5, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(30);
	cv_signal(&cv1);
	l4thread_sleep(200);

	printf("----------------------------------------\n");

	printf("waking up two threads by signal\n");
	l4thread_create(cond, (void*) 6, L4THREAD_CREATE_ASYNC);
	l4thread_create(cond, (void*) 7, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(30);
	cv_signal(&cv1);
	l4thread_sleep(30);
	cv_signal(&cv1);
	l4thread_sleep(200);

	printf("----------------------------------------\n");

	printf("waking up two threads by broadcast\n");
	l4thread_create(cond, (void*) 8, L4THREAD_CREATE_ASYNC);
	l4thread_create(cond, (void*) 9, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(30);
	cv_broadcast(&cv1);
	l4thread_sleep(200);

	printf("----------------------------------------\n");

	l4thread_sleep_forever();
	return 0;
}
예제 #4
0
파일: main.c 프로젝트: RajasekharBhumi/L4Re
int main(int argc, char **argv) {
	ddekit_init();
	bsd_dde_init();

	printf("- uninitialized, mtx_initialized= %d\n", mtx_initialized(&m));

	mtx_init(&m, "test mutex", "test", MTX_DEF|MTX_RECURSE);
	printf("- initialized,   mtx_initialized= %d\n", mtx_initialized(&m));
	printf("                 mtx_name       =\"%s\"\n", mtx_name(&m));
	printf("                 mtx_owned      = %d\n", mtx_owned(&m));
	printf("                 mtx_recursed   = %d\n", mtx_recursed(&m));

	l4thread_create(mdwn, (void*) 1, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(200);

	mtx_lock(&m);
	printf("- locked         mtx_owned      = %d\n", mtx_owned(&m));
	printf("                 mtx_recursed   = %d\n", mtx_recursed(&m));

	l4thread_create(mdwn, (void*) 2, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(200);

	mtx_lock(&m);
	printf("- locked x2      mtx_owned      = %d\n", mtx_owned(&m));
	printf("                 mtx_recursed   = %d\n", mtx_recursed(&m));

	l4thread_create(mdwn, (void*) 3, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(200);

	mtx_lock(&m);
	printf("- locked x3      mtx_owned      = %d\n", mtx_owned(&m));
	printf("                 mtx_recursed   = %d\n", mtx_recursed(&m));

	l4thread_create(mdwn, (void*) 4, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(200);

	mtx_unlock(&m);
	printf("- unlocked x1    mtx_owned      = %d\n", mtx_owned(&m));
	printf("                 mtx_recursed   = %d\n", mtx_recursed(&m));

	l4thread_create(mdwn, (void*) 5, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(200);

	mtx_unlock(&m);
	printf("- unlocked x2    mtx_owned      = %d\n", mtx_owned(&m));
	printf("                 mtx_recursed   = %d\n", mtx_recursed(&m));

	l4thread_create(mdwn, (void*) 6, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(200);

	mtx_unlock(&m);
	printf("- unlocked x3    mtx_owned      = %d\n", mtx_owned(&m));
	printf("                 mtx_recursed   = %d\n", mtx_recursed(&m));

	l4thread_create(mdwn, (void*) 7, L4THREAD_CREATE_ASYNC);
	l4thread_sleep(200);

	mtx_destroy(&m);
	printf("- destroyed,     mtx_initialized= %d\n", mtx_initialized(&m));

	l4thread_sleep_forever();
	return 0;
}