NaviServer - programmable web server
4.99  5.0

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

ns_cond(n) 4.99.30 naviserver "NaviServer Built-in Commands"

Name

ns_cond - Operate on condition variables

Table Of Contents

Synopsis

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. If timeout is specified, it refers to an absolute time in Unix seconds 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 wait 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

ns_event, ns_mutex, ns_thread, nsd

Keywords

mutex, server built-in, thread