Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cond_timedwait(3synch) — UnixWare 2.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

condition(3synch)

cond_broadcast(3synch)

cond_destroy(3synch)

cond_init(3synch)

cond_signal(3synch)

cond_wait(3synch)

gettimeofday(2)

synch(3synch)






       cond_timedwait(3synch)                        cond_timedwait(3synch)


       NAME
             cond_timedwait - wait on a condition variable for a limited
             time

       SYNOPSIS
             cc [options] -Kthread file
             #include <synch.h>
             #include <sys/time.h>
             int cond_timedwait(cond_t *cond, mutex_t *mutex, timestruc_t *abstime);

          Parameters
             cond    pointer to the condition variable to wait for

             mutex   pointer to a locked mutex

             abstime absolute time to at which to time out

       DESCRIPTION
             cond_timedwait, similar to cond_wait, blocks the calling
             thread at the condition variable pointed to by cond, to wait
             for the occurrence of a condition.  However, if the absolute
             time denoted by abstime has passed and the indicated condition
             is not signaled, cond_timedwait returns ETIME to the caller.
             The calling thread must lock the mutual exclusion lock (mutex)
             pointed to by mutex before calling cond_timedwait, otherwise
             the behavior is unpredictable.

             cond_timedwait automatically releases the mutex, and waits on
             the condition variable cond.  When the condition is signaled
             or the time expires, cond_timedwait reacquires the mutex and
             returns to the caller.  The wait can also be interrupted by a
             UNIX system signal, in which case mutex is reacquired, the
             signal handler is called, and cond_timedwait returns EINTR.

             User-visible timers are not affected by a call to
             cond_timedwait.

             The calling thread can resume execution when the condition is
             signaled or broadcast, a timeout occurs, or when interrupted.
             The logical condition should be checked on return, as a return
             may not have been caused by a change in the condition.

          cond Parameter
             The condition variable denoted by cond must previously have
             been initialized (see cond_init).



                           Copyright 1994 Novell, Inc.               Page 1













      cond_timedwait(3synch)                        cond_timedwait(3synch)


         mutex Parameter
            mutex is a mutual exclusion variable protecting a shared
            resource associated with the condition represented by the
            condition variable, cond.  The calling thread must lock mutex
            before calling cond_wait, otherwise the behavior is
            unpredictable.

         abstime Parameter
            abstime represents the time at which cond_timedwait should
            time out.  The time is expressed in elapsed seconds and
            nanoseconds since Universal Coordinated Time, January 1, 1970.
            gettimeofday(2) returns the current time, but in seconds and
            microseconds.  To construct abstime, convert the current time
            to a timestruc_t, and add to that the waiting time.

         Return Values
            cond_timedwait returns zero for success and an error number
            for failure, as described below.

         Errors
            If any of the following conditions is detected, cond_timedwait
            returns the corresponding value:

            EINTR    The wait was interrupted by a UNIX system signal.

            EINVAL   Invalid argument specified.

            EINVAL   abstime is NULL.

            ETIME    Time specified by abstime has passed.

      USAGE
            See the description of how to use condition variables under
            USAGE on cond_init(3synch).

            Because the condition can change between the time the
            condition is signaled and the mutex is re-locked, the calling
            thread must always re-check the condition upon return from
            cond_timedwait.

      REFERENCES
            condition(3synch), cond_broadcast(3synch),
            cond_destroy(3synch), cond_init(3synch), cond_signal(3synch),
            cond_wait(3synch), gettimeofday(2), synch(3synch)




                          Copyright 1994 Novell, Inc.               Page 2








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