2000-03-05 17:39:33 +00:00
|
|
|
<html><head>
|
2000-09-22 13:45:58 +00:00
|
|
|
<title>NSLock</title>
|
2000-03-05 17:39:33 +00:00
|
|
|
</head>
|
|
|
|
<body>
|
2001-04-25 14:19:57 +00:00
|
|
|
<a href ="NSInvocation.html">[Previous] </a>
|
|
|
|
<a href ="Base.html">[Up] </a>
|
|
|
|
<a href ="NSMethodSignature.html">[Next] </a>
|
2000-03-05 17:39:33 +00:00
|
|
|
<h1>NSLock</h1>
|
2000-09-22 13:45:58 +00:00
|
|
|
<h3>Authors </h3>
|
|
|
|
<dl>
|
2001-04-19 17:28:22 +00:00
|
|
|
<dt><a href ="http://www.gnustep.org/developers/whoiswho.html">Adam Fedor</a>
|
2000-03-05 17:39:33 +00:00
|
|
|
<dd>
|
|
|
|
</dl>
|
2001-03-03 10:00:31 +00:00
|
|
|
<p>Version: $Revision$</p>
|
|
|
|
<p>Date: $Date$</p>
|
2000-09-22 13:45:58 +00:00
|
|
|
<h2><a name ="cont-0">NSLock</a></h2>
|
|
|
|
<h2><a name ="NSLock">NSLock</a></h2>
|
|
|
|
<p><b>Declared in: </b> Foundation/NSLock.h</p>
|
|
|
|
<p><b>Inherits from: </b> NSObject</p>
|
|
|
|
<p><b>Conforms to: </b> NSLocking
|
2000-03-05 17:39:33 +00:00
|
|
|
</p>
|
|
|
|
<hr>
|
|
|
|
|
2001-04-19 17:28:22 +00:00
|
|
|
An NSLock is used in multi-threaded applications to protect critical
|
|
|
|
pieces of code. While one thread holds a lock within a piece of code,
|
|
|
|
another thread cannot execute that code until the first thread has
|
|
|
|
given up it's hold on the lock. The limitation of NSLock is that
|
|
|
|
you can only lock an
|
|
|
|
NSLock once and it must be unlocked before it can be aquired again.
|
|
|
|
Other lock classes, notably NSRecursiveLock, have
|
|
|
|
different restrictions.
|
2000-03-05 17:39:33 +00:00
|
|
|
|
2000-09-22 13:45:58 +00:00
|
|
|
<h2>Instance Variables </h2>
|
2000-09-15 19:56:39 +00:00
|
|
|
<ul>
|
|
|
|
</ul>
|
2000-09-22 13:45:58 +00:00
|
|
|
<h2>Methods </h2>
|
2000-03-05 17:39:33 +00:00
|
|
|
<ul>
|
2001-04-25 14:19:57 +00:00
|
|
|
<li ><a href ="NSLock.html#method-0">-lockBeforeDate:</a>
|
|
|
|
<li ><a href ="NSLock.html#method-1">-tryLock</a>
|
2000-03-05 17:39:33 +00:00
|
|
|
</ul>
|
2000-09-22 13:45:58 +00:00
|
|
|
<hr><h2>Instances Methods </h2>
|
|
|
|
<h3><a name ="method-0">lockBeforeDate:</a></h3>
|
|
|
|
- (BOOL) <b>lockBeforeDate:</b> (NSDate*)limit;<br>
|
2000-03-05 17:39:33 +00:00
|
|
|
|
2001-04-19 17:28:22 +00:00
|
|
|
Attempts to aquire a lock before the date limit passes. It returns YES
|
|
|
|
if it can. It returns NO if it cannot, or if the current thread already
|
|
|
|
has the lock (but it waits until the time limit is up before returning
|
|
|
|
NO).
|
2000-03-05 17:39:33 +00:00
|
|
|
|
2000-09-22 13:45:58 +00:00
|
|
|
<hr>
|
|
|
|
<h3><a name ="method-1">tryLock</a></h3>
|
2000-07-04 19:53:39 +00:00
|
|
|
- (BOOL) <b>tryLock</b>;<br>
|
2000-03-05 17:39:33 +00:00
|
|
|
|
2001-04-19 17:28:22 +00:00
|
|
|
Attempts to aquire a lock, but returns immediately if the lock
|
|
|
|
cannot be aquired. It returns YES if the lock is aquired. It returns
|
|
|
|
NO if the lock cannot be aquired or if the current thread already has
|
|
|
|
the lock.
|
2000-03-05 17:39:33 +00:00
|
|
|
|
2000-09-22 13:45:58 +00:00
|
|
|
<hr>
|
2000-03-05 17:39:33 +00:00
|
|
|
</body>
|
|
|
|
|
2000-09-22 13:45:58 +00:00
|
|
|
</html>
|