Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dg_pthread_sleep(3T) — DG/UX R4.11

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sleep(3T)



dg_pthread_sleep(3T)              SDK R4.11             dg_pthread_sleep(3T)


NAME
       dgpthreadsleep - sleep with nanosecond granularity

SYNOPSIS
       #include <pthread.h>
       #include <timers.h>

       int dgpthreadsleep(const struct timespec *sleeptimeptr,
                            struct timespec *unslepttimeptr);

   where:
       sleeptimeptr
              A pointer to the relative amount of time to sleep
       unslepttimeptr
              A pointer to a location to receive the unslept time, or NULL

DESCRIPTION
       The dgpthreadsleep causes the calling thread to sleep for the
       amount of time specified in the struct timespec pointed to by
       sleeptimeptr or until some kind of software interruption occurs
       (e.g., a signal).  In either case, this routine returns 0 and, if
       unslepttimeptr is not NULL, the amount of unslept time is stored in
       the struct timespec pointed to by unslepttimeptr.

       If this call returns with unslept time, the caller cannot necessarily
       assume that a signal has been processed.  This call may spuriously
       return with unslept time at any point.  Proper use of this function
       typically involves calling it in a loop until the unslept time counts
       down to zero.

       This call is a pthread cancellation point, as are the sleep() family
       of calls.

DIAGNOSTICS
   Returns
       The dgpthreadsleep() function always succeeds and returns 0.

SEE ALSO
       sleep(3T), pthreadcondtimedwait(3T).

NOTES
       The main advantage of this function is that it allows threads to
       sleep with nanosecond granularity without having to use
       pthreadcondtimedwait().  Unlike pthreadcondtimedwait(),
       dgpthreadsleep() sleeps for a relative amount of time from the
       present instead of until an absolute time point in the future.
       However, this call is not portable.

       The final standard will likely include a similar function, called
       nanosleep(), that accepts a struct timespec.  In such a case,
       dgpthreadsleep() may be phased out eventually.


Licensed material--property of copyright holder(s)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026