Exemple #1
33
int main(int argc, char *argv[])
{
	TASK_ID rtid, ptid;

	copperplate_init(argc, argv);

	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));

	rtid = taskSpawn("rootTask", 50, 0, 0, rootTask,
			 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	traceobj_assert(&trobj, rtid != ERROR);

	traceobj_mark(&trobj, 18);

	ptid = taskSpawn("peerTask", 10, 0, 0, peerTask,
			 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	traceobj_assert(&trobj, ptid != ERROR);

	traceobj_mark(&trobj, 19);

	traceobj_join(&trobj);

	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));

	exit(0);
}
Exemple #2
5
int main(int argc, char *const argv[])
{
	TASK_ID rtid, ptid;

	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));

	traceobj_mark(&trobj, 11);

	rtid = taskSpawn("rootTask", 50, 0, 0, rootTask,
			 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	traceobj_assert(&trobj, rtid != ERROR);

	traceobj_mark(&trobj, 12);

	ptid = taskSpawn("peerTask",
			 51,
			 0, 0, peerTask, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	traceobj_assert(&trobj, ptid != ERROR);

	traceobj_mark(&trobj, 13);

	traceobj_join(&trobj);

	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));

	exit(0);
}
Exemple #3
0
int main(int argc, char *argv[])
{
	u_long args[] = { 1, 2, 3, 4 };
	int ret;

	copperplate_init(argc, argv);

	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));

	traceobj_mark(&trobj, 1);

	ret = t_create("TASK", 20, 0, 0, 0, &tid);
	traceobj_assert(&trobj, ret == SUCCESS);

	ret = t_start(tid, 0, task, args);
	traceobj_assert(&trobj, ret == SUCCESS);

	traceobj_mark(&trobj, 2);

	traceobj_join(&trobj);

	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));

	exit(0);
}
Exemple #4
0
int main(int argc, char *const argv[])
{
	int ret;

	traceobj_init(&trobj, argv[0], 0);

	ret = rt_sem_create(&sem, "SEMA", 0, S_FIFO);
	traceobj_check(&trobj, ret, 0);

	ret = rt_task_create(&t_rr1, "rr_task_1", 0, 10, 0);
	traceobj_check(&trobj, ret, 0);

	ret = rt_task_start(&t_rr1, rr_task, "t1");
	traceobj_check(&trobj, ret, 0);

	ret = rt_task_create(&t_rr2, "rr_task_2", 0, 10, 0);
	traceobj_check(&trobj, ret, 0);

	ret = rt_task_start(&t_rr2, rr_task, "t2");
	traceobj_check(&trobj, ret, 0);

	ret = rt_sem_broadcast(&sem);
	traceobj_check(&trobj, ret, 0);

	traceobj_join(&trobj);

	exit(0);
}
Exemple #5
0
int main(int argc, char *argv[])
{
	TASK_ID tid;
	int ret;

	copperplate_init(argc, argv);

	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));

	tid = taskSpawn("rootTask", 50, 0, 0, rootTask,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	traceobj_assert(&trobj, tid != ERROR);

	traceobj_mark(&trobj, 5);

	ret = semDelete(sem_id);
	traceobj_assert(&trobj, ret == OK);

	traceobj_mark(&trobj, 6);

	traceobj_join(&trobj);

	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));

	exit(0);
}
Exemple #6
0
int main(int argc, char *const argv[])
{
	TASK_ID tid;

	traceobj_init(&trobj, argv[0], 0);

	tid = taskSpawn("rootTask", 50, 0, 0, rootTask,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	traceobj_assert(&trobj, tid != ERROR);

	traceobj_join(&trobj);

	exit(0);
}
Exemple #7
0
int main(int argc, char *argv[])
{
	TASK_ID tid;

	copperplate_init(argc, argv);

	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));

	tid = taskSpawn("rootTask", 50,	0, 0, rootTask,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	traceobj_assert(&trobj, tid != ERROR);

	traceobj_join(&trobj);

	exit(0);
}
Exemple #8
0
int main(int argc, char *const argv[])
{
	int ret;

	traceobj_init(&trobj, argv[0], 0);

	ret = rt_task_create(&t_main, "main_task", 0, 99, 0);
	traceobj_assert(&trobj, ret == 0);

	ret = rt_task_start(&t_main, main_task, (void *)(long)0xdeadbeef);
	traceobj_assert(&trobj, ret == 0);

	traceobj_join(&trobj);

	exit(0);
}
Exemple #9
0
int main(int argc, char *argv[])
{
	u_long args[] = { 1, 2, 3, 4 }, msgbuf[4], count;
	int ret, n;

	copperplate_init(argc, argv);

	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));

	ret = q_create("QUEUE", Q_NOLIMIT, 0, &qid);
	traceobj_assert(&trobj, ret == SUCCESS);

	ret = t_create("TSKA", 21, 0, 0, 0, &tidA);
	traceobj_assert(&trobj, ret == SUCCESS);

	ret = t_create("TSKB", 20, 0, 0, 0, &tidB);
	traceobj_assert(&trobj, ret == SUCCESS);

	ret = t_start(tidA, 0, task_A, args);
	traceobj_assert(&trobj, ret == SUCCESS);

	ret = t_start(tidB, 0, task_B, args);
	traceobj_assert(&trobj, ret == SUCCESS);

	for (n = 0; n < 3; n++) {
		msgbuf[0] = n + 1;
		msgbuf[1] = n + 2;
		msgbuf[2] = n + 3;
		msgbuf[3] = n + 4;
		count = 0;
		traceobj_mark(&trobj, 7);
		ret = q_broadcast(qid, msgbuf, &count);
		traceobj_assert(&trobj, ret == SUCCESS && count == 2);
	}

	traceobj_mark(&trobj, 8);

	traceobj_join(&trobj);

	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));

	ret = q_delete(qid);
	traceobj_assert(&trobj, ret == SUCCESS);

	exit(0);
}
Exemple #10
0
int main(int argc, char *const argv[])
{
	TASK_ID tid;
	int ret;

	traceobj_init(&trobj, argv[0], 0);

	tid = taskSpawn("rootTask", 50, 0, 0, rootTask,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	traceobj_assert(&trobj, tid != ERROR);

	traceobj_join(&trobj);

	ret = semDelete(sem_id);
	traceobj_assert(&trobj, ret == OK);

	exit(0);
}
Exemple #11
0
int main(int argc, char *const argv[])
{
	int ret;

	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));

	sem_id = semCCreate(SEM_Q_PRIORITY, 0);
	traceobj_assert(&trobj, sem_id != 0);

	traceobj_mark(&trobj, 8);

	btid = taskSpawn("backgroundTask", 11, 0, 0, backgroundTask,
			0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	traceobj_assert(&trobj, btid != ERROR);

	traceobj_mark(&trobj, 9);

	ftid = taskSpawn("foregroundTask", 10, 0, 0, foregroundTask,
			 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
	traceobj_assert(&trobj, ftid != ERROR);

	traceobj_mark(&trobj, 10);

	ret = semGive(sem_id);

	traceobj_assert(&trobj, ret == OK);

	traceobj_mark(&trobj, 11);

	ret = semGive(sem_id);

	traceobj_assert(&trobj, ret == OK);

	traceobj_mark(&trobj, 12);

	ret = taskDelete(btid);
	traceobj_assert(&trobj, ret == OK);

	traceobj_join(&trobj);

	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));

	exit(0);
}
Exemple #12
0
int main(int argc, char *const argv[])
{
	int ret;

	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));

	ret = rt_alarm_create(&alrm, "ALARM", alarm_handler, &alrm);
	traceobj_check(&trobj, ret, 0);

	ret = rt_task_spawn(&t_main, "main_task", 0,  50, 0, main_task, NULL);
	traceobj_check(&trobj, ret, 0);

	traceobj_mark(&trobj, 8);

	traceobj_join(&trobj);

	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));

	exit(0);
}
Exemple #13
0
int main(int argc, char *const argv[])
{
	int ret;

	traceobj_init(&trobj, argv[0], sizeof(tseq) / sizeof(int));

	ret = rt_sem_create(&sem, "SEMA", 0, S_FIFO);
	traceobj_check(&trobj, ret, 0);

	ret = rt_task_create(&t_test, "test_task", 0, 10, 0);
	traceobj_check(&trobj, ret, 0);

	traceobj_mark(&trobj, 1);

	ret = rt_task_start(&t_test, test_task, NULL);
	traceobj_check(&trobj, ret, 0);

	traceobj_mark(&trobj, 2);

	ret = rt_task_suspend(&t_test);
	traceobj_check(&trobj, ret, 0);

	traceobj_mark(&trobj, 3);

	ret = rt_sem_v(&sem);
	traceobj_check(&trobj, ret, 0);

	traceobj_mark(&trobj, 4);

	ret = rt_task_resume(&t_test);
	traceobj_check(&trobj, ret, 0);

	traceobj_mark(&trobj, 5);

	traceobj_join(&trobj);

	traceobj_verify(&trobj, tseq, sizeof(tseq) / sizeof(int));

	exit(0);
}