mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
merge back reorganisation branch
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@29615 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6bf6ec959b
commit
21d597e740
263 changed files with 5577 additions and 4170 deletions
|
@ -71,9 +71,11 @@ extern "C" {
|
|||
*/
|
||||
@interface NSLock : NSObject <NSLocking>
|
||||
{
|
||||
#if GS_EXPOSE(NSLock)
|
||||
@private
|
||||
gs_mutex_t _mutex;
|
||||
NSString *_name;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,10 +115,12 @@ extern "C" {
|
|||
*/
|
||||
@interface NSCondition : NSObject <NSLocking>
|
||||
{
|
||||
#if GS_EXPOSE(NSCondition)
|
||||
@private
|
||||
gs_cond_t _condition;
|
||||
gs_mutex_t _mutex;
|
||||
NSString *_name;
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* Blocks and atomically unlocks the receiver.
|
||||
|
@ -161,10 +165,12 @@ extern "C" {
|
|||
*/
|
||||
@interface NSConditionLock : NSObject <NSLocking>
|
||||
{
|
||||
#if GS_EXPOSE(NSConditionLock)
|
||||
@private
|
||||
NSCondition *_condition;
|
||||
int _condition_value;
|
||||
NSString *_name;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -252,9 +258,11 @@ extern "C" {
|
|||
*/
|
||||
@interface NSRecursiveLock : NSObject <NSLocking>
|
||||
{
|
||||
#if GS_EXPOSE(NSRecursiveLock)
|
||||
@private
|
||||
gs_mutex_t _mutex;
|
||||
NSString *_name;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -290,96 +298,6 @@ extern "C" {
|
|||
|
||||
@end
|
||||
|
||||
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
|
||||
|
||||
/**
|
||||
* 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+newLockAt:] for details.
|
||||
* This macro is intended for code that cannot insure
|
||||
* that a lock can be initialized in thread safe manner otherwise.
|
||||
* <example>
|
||||
* NSLock *my_lock = nil;
|
||||
*
|
||||
* void function (void)
|
||||
* {
|
||||
* [GS_INITIALIZED_LOCK(my_lock, NSLock) lock];
|
||||
* do_work ();
|
||||
* [my_lock unlock];
|
||||
* }
|
||||
*
|
||||
* </example>
|
||||
*/
|
||||
#define GS_INITIALIZED_LOCK(IDENT,CLASSNAME) \
|
||||
(IDENT != nil ? (id)IDENT : (id)[CLASSNAME newLockAt: &IDENT])
|
||||
|
||||
/**
|
||||
* Defines the <code>newLockAt:</code> method.
|
||||
*/
|
||||
@interface NSLock (GSCategories)
|
||||
/**
|
||||
* 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.
|
||||
* <br/>
|
||||
* 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.
|
||||
* <example>
|
||||
* NSLock *my_lock = nil;
|
||||
*
|
||||
* void function (void)
|
||||
* {
|
||||
* [GS_INITIALIZED_LOCK(my_lock, NSLock) lock];
|
||||
* do_work ();
|
||||
* [my_lock unlock];
|
||||
* }
|
||||
*
|
||||
* </example>
|
||||
*/
|
||||
+ (id) newLockAt: (id *)location;
|
||||
@end
|
||||
|
||||
/**
|
||||
* Defines the <code>newLockAt:</code> method.
|
||||
*/
|
||||
@interface NSRecursiveLock (GSCategories)
|
||||
/**
|
||||
* 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.
|
||||
* <br/>
|
||||
* 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.
|
||||
* <example>
|
||||
* NSLock *my_lock = nil;
|
||||
*
|
||||
* void function (void)
|
||||
* {
|
||||
* [GS_INITIALIZED_LOCK(my_lock, NSRecursiveLock) lock];
|
||||
* do_work ();
|
||||
* [my_lock unlock];
|
||||
* }
|
||||
*
|
||||
* </example>
|
||||
*/
|
||||
+ (id) newLockAt: (id *)location;
|
||||
@end
|
||||
|
||||
#endif /* GS_API_NONE */
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue