implementing a POSIX Timer example - VxWorks

This is a discussion on implementing a POSIX Timer example - VxWorks ; Hello , I'm trying to implement a timer which runs in every 5seconds and prints "Hello World!" I created the timer successfuly but don't know how to catch the signal. (actullay i did it with wdtimer) Can someone give me ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: implementing a POSIX Timer example

  1. implementing a POSIX Timer example

    Hello ,

    I'm trying to implement a timer which runs in every 5seconds and
    prints "Hello World!"

    I created the timer successfuly but don't know how to catch the signal.
    (actullay i did it with wdtimer)

    Can someone give me an example about signal handling with timers.

    Regards.


  2. Re: implementing a POSIX Timer example

    On Sep 7, 12:36 pm, tguclu wrote:
    > Hello ,
    >
    > I'm trying to implement a timer which runs in every 5seconds and
    > prints "Hello World!"
    >
    > I created the timer successfuly but don't know how to catch the signal.
    > (actullay i did it with wdtimer)
    >
    > Can someone give me an example about signal handling with timers.
    >
    > Regards.


    Are you expecting something like below

    void my_handler
    ( timer_t timerid,
    int myarg );

    void start_timer(void)
    {

    timer_t timerid;
    struct itimerspec value;

    value.it_value.tv_sec = 5;
    value.it_value.tv_nsec = 0;

    value.it_interval.tv_sec = 5;
    value.it_interval.tv_nsec = 0;

    timer_create (CLOCK_REALTIME, NULL, &timerid);

    timer_connect (timerid, my_handler,0);

    timer_settime (timerid, 0, &value, NULL);

    }

    void my_handler
    ( timer_t timerid,
    int myarg )
    {

    printf("\nHello World\n");

    }


+ Reply to Thread