#include <time.h>

#include <sys/types.h>
#include <sys/param.h>

#include <sys/ipc.h>
#include <sys/shm.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <stdarg.h>

#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/rtprio.h>
#include <sys/lock.h>

/****************************************************************/
/* Function    : dm_taskDelay					*/
/* Purpose     : Suspend for fixed time				*/
/* Inputs      : Delay time, in system ticks			*/
/* Outputs     : OK						*/
/****************************************************************/

void dm_taskDelay( int ticks)
{
    struct itimerval	timer;

    signal( SIGALRM, taskDelayDone );
    bzero( (char *)&timer, sizeof(struct itimerval) );
    timer.it_value.tv_sec = ticks / HZ;
    timer.it_value.tv_usec = (ticks % HZ) * (1000000 / HZ);
    sigblock( sigmask(SIGALRM) );
    setitimer( ITIMER_REAL, &timer, (struct itimerval *)NULL );
    sigpause( 0L );
    return;

} 

