Exemple #1
0
static void Task2(long t)
{
	int status;
	MSG buf;

	rt_printk("\nTask2 (%p) starting\n", rt_whoami());
	while (1) {
		memset((char*)&buf, 0, sizeof(buf));
		status = rt_tbx_receive(&bx, (char*)&buf, sizeof(buf));
		rt_printk("\nTask2 received msgnr %u from task %u, status=%d\n", buf.progressive, buf.sending_task, status);
	}
}
Exemple #2
0
static void Task3(long t) 
{   
	int status;
	char buf[100];
    
	rt_printk("\nTask3 (%p) starting\n", rt_whoami());
	while (1) {
		status = rt_tbx_receive(&bx, buf, sizeof(msg1)); 
		rt_printk("\nTask3 received %s, status=%d\n", buf, status);
		memset(buf, 0, sizeof(buf));    
	}
}
static void *Task2(void *arg)
{   
	RT_TASK *t2;
	int status;
	MSG buf;
    
	t2 = rt_task_init_schmod(nam2num("T2"), BASE_PRIO + 3, 0, 0, SCHED_FIFO, 0xF);
	printf("\nTask2 (%p) starting\n", t2);
	mlockall(MCL_CURRENT | MCL_FUTURE);

	while (!endall) {
		memset((char*)&buf, 0, sizeof(buf));    
		status = rt_tbx_receive(bx, (char*)&buf, sizeof(buf)); 
		printf("\nTask2 received msgnr %u from task %u, status=%d\n", buf.progressive, buf.sending_task, status);
	}
	printf("\nTask2 ends itself\n");
	return 0;
}