Listing 1. Initialization Code

int init_module(void)
{
    pthread_attr_t attr;
    struct sched_param sched_param;

    rtf_destroy(0);
    rtf_destroy(1);
    rtf_destroy(2);
    rtf_destroy(3);
    rtf_destroy(4);
    rtf_create(0, 4000); //user-space interaction
    rtf_create(1, 4000); //channel from fifo handler
                         //to thread 1
    rtf_create(2, 4000); //channel from fifo handler
                         //to thread 2
    rtf_create(3, 4000); //fifo from thread 1 back
                         //to user space
    rtf_create(4, 4000); //fifo from thread 2 back
                         //to user space

    pthread_attr_init (&attr);
    sched_param.sched_priority = 4;
    pthread_attr_setschedparam (&attr, &sched_param);
    pthread_create (&tasks[0], &attr, thread_code,
    (void *)0);

    pthread_attr_init (&attr);
    sched_param.sched_priority = 4;
    pthread_attr_setschedparam (&attr, &sched_param);
    pthread_create (&tasks[1], &attr, thread_code,
    (void *)1);

    rtf_create_handler(0, &my_handler);
    return 0;
}