Returns IDENT which will be initialized to an
instance of a CLASSNAME in a thread safe manner. If
IDENT has been previously initialized this macro merely
returns IDENT. IDENT is considered uninitialized, if
it contains
nil
. CLASSNAME must be either
NSLock, NSRecursiveLock or one of their subclasses.
See
[NSLock(GNUstepBase) +newLockAt:]
for details. This macro is intended for code that cannot insure that a lock can be initialized in thread safe manner otherwise.
NSLock *my_lock = nil;
void function (void)
{
[GS_INITIALIZED_LOCK(my_lock, NSLock) lock];
do_work ();
[my_lock unlock];
}
+ (id)
newLockAt: (id*)location;
Availability: Not in OpenStep/MacOS-X
Initializes the
id pointed to
by
location with a new instance of the
receiver's class in a thread safe manner, unless
it has been previously initialized. Returns the contents
pointed to by
location. The
location is considered unintialized if it
contains
nil
.
This method is
used in the GS_INITIALIZED_LOCK macro to initialize
lock variables when it cannot be insured that they can
be initialized in a thread safe environment.
NSLock *my_lock = nil;
void function (void)
{
[GS_INITIALIZED_LOCK(my_lock, NSLock) lock];
do_work ();
[my_lock unlock];
}
+ (id)
newLockAt: (id*)location;
Availability: Not in OpenStep/MacOS-X
Initializes the
id pointed to
by
location with a new instance of the
receiver's class in a thread safe manner, unless
it has been previously initialized. Returns the contents
pointed to by
location. The
location is considered unintialized if it
contains
nil
.
This method is
used in the GS_INITIALIZED_LOCK macro to initialize
lock variables when it cannot be insured that they can
be initialized in a thread safe environment.
NSLock *my_lock = nil;
void function (void)
{
[GS_INITIALIZED_LOCK(my_lock, NSLock) lock];
do_work ();
[my_lock unlock];
}