[ Table Of Contents | Keyword Index ]

ns_cond(n) 4.99 "NaviServer Built-in Commands"

NAME

ns_cond - Operate on condition variables

TABLE OF CONTENTS

    TABLE OF CONTENTS
    SYNOPSIS
    DESCRIPTION
    COMMANDS
    EXAMPLES
    SEE ALSO
    KEYWORDS

SYNOPSIS

ns_cond option ?arg arg ...?
ns_cond broadcast object
ns_cond create
ns_cond destroy object
ns_cond set object
ns_cond abswait condId mutexId ?timeout?
ns_cond timedwait condId mutexId ?timeout?

DESCRIPTION

This command provides a mechanism to manipulate condition variables.

ns_cond option ?arg arg ...?

COMMANDS

ns_cond broadcast object
Wakes up all threads waiting on the specified object.

ns_cond create
Initializes a new condition variable and returns a handle to it.

ns_cond destroy object
Destroys the condition variable and frees any resources it was using. NOTE: No threads must be waiting on the condition variable, or else the behavior is undefined and will likely crash the server.

ns_cond set object
Wakes up one thread waiting on the specified object. If more than one thread is waiting, only one is woken up. If no threads are waiting, nothing happens.

ns_cond abswait condId mutexId ?timeout?
Waits on a condition variable. timeout is an absolute time in Unix seconds when to wait until. If not specified, timeout defaults to 0, which causes the command to not sleep at all. Returns 1 on success or 0 on timeout.

ns_cond timedwait condId mutexId ?timeout?
Waits on a condition variable. If timeout is not specified, the thread will sleep indefinitely. Otherwise, the thread will wait up to timeout seconds. Returns 1 on success or 0 on timeout.

EXAMPLES

SEE ALSO

nsd

KEYWORDS

ns_event , ns_mutex , ns_thread