Difference between revisions of "Ns mutex"

From AOLserver Wiki
Jump to navigation Jump to search
(imported from WiKit id 605)
 
Line 14: Line 14:
  
 
: This command provides a mechanism to manipulate mutexes.  The legal ''option''s (which may be abbreviated) are:
 
: This command provides a mechanism to manipulate mutexes.  The legal ''option''s (which may be abbreviated) are:
* '''ns_mutex create'''
+
* '''ns_mutex create''' ''?name?''
  
: Initializes a new mutual exclusion (mutex) lock and returns a handle to it.
+
: Initializes a new mutual exclusion (mutex) lock and returns a handle to it.  If ''name'' is provided the mutex name will be set to this value.
 
* '''ns_mutex destroy''' ''object''
 
* '''ns_mutex destroy''' ''object''
  

Revision as of 12:45, 7 October 2005

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


NAME

ns_mutex - Operate on mutexes

SYNOPSIS

ns_mutex option ?arg arg ...?

DESCRIPTION

This command provides a mechanism to manipulate mutexes. The legal options (which may be abbreviated) are:
  • ns_mutex create ?name?
Initializes a new mutual exclusion (mutex) lock and returns a handle to it. If name is provided the mutex name will be set to this value.
  • ns_mutex destroy object
Destroys the mutex and frees any resources it was using.
NOTE: The mutex must be unlocked, or else the behavior is undefined and will likely crash the server. Before using this, you should probably look at Implementing a Mutex Pool instead.
  • ns_mutex lock object
Attempt to acquire the mutex lock and block if it is already locked.
  • ns_mutex unlock object
Release a previously acquired mutex lock.

EXAMPLES

SEE ALSO

ns_cond, ns_critsec, ns_event, ns_thread

Category Documentation - Category Core Tcl API