Ns cond

From AOLserver Wiki
Revision as of 22:50, 9 June 2004 by WikiSysop (talk | contribs) (imported from WiKit id 534)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Man page: http://aolserver.com/docs/tcl/ns_cond.html


NAME

ns_cond - Operate on condition variables

SYNOPSIS

ns_cond option ?arg arg ...?

DESCRIPTION

This command provides a mechanism to manipulate condition variables. The legal options (which may be abbreviated) are:
  • 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
  • ns_cond signal 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?
  • 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

Category Documentation - Category Core Tcl API