Listing 1. Example Real-Time Module Code Skeleton

#include <pthread.h>
#include <rtl_fifo.h>
#include <rtl_core.h>
#include <rtl_time.h>
#include <rtl.h>
#include <rtl_fifo.h>

pthread_t thread_variable;

void thread_name(void)
{
    Struct Sched_param p;
    p.sched_priority = 1
    pthread_setschedparam(pthread_self(),
                          SCHED_FIFO, &p);
    pthread_make periodicnp(pthread_self(),
                            getrtime(), 1000000);
    while(1) {
        // Real Time Task Code
        // Poll Data input lines, count low to high
        // transitions
        rtf_put() // Counts to be transferred by FIFO
        pthread_wait_np();
    }
}

int handler_function(){
    // Code tied to the handler FIFO
    // Variables for counting above are cleared out
}

int init_module(void)
{
    ififo_status =  rtl_create(unsigned int fifo,
                               int size)
    pthread_create(&thread_variable, NULL,
                   thread_name, NULL);
    rtf_create_handler(FIFO_Number,
                       &handler_function)
}

int cleanup_module(void)
{
    rtf_destroy(unsigned int fifo)
    pthread_cancel(thrad_variable)
}

