This is CJRLock.h in view mode; [Download] [Up]
/*
* CJRLock -- Foundation Kit-less NSLock, NSConditionLock
* Compatibile with Foundation Kit from EOF 1.1, which shipped with
* NS3.3 Academic Bundle).
*
* (c) 1997 Chris Roehrig <croehrig@House.ORG>
*
* Doesn't implement timeout methods.
* Doesn't implement NSRecursiveLock.
*/
#import <objc/Object.h>
#import <mach/cthreads.h>
@protocol CJRLocking
- (void)lock;
- (void)unlock;
@end
/*************** CJRLock ***************/
@interface CJRLock:Object <CJRLocking> {
@private
mutex_t mutex;
}
- (BOOL)tryLock;
/* Returns YES iff lock acquired; returns immediately */
@end
/*************** CJRConditionLock ***************/
@interface CJRConditionLock:Object <CJRLocking> {
@private
mutex_t mutex; // lock to protect data
volatile int data;
condition_t cond;
}
- initWithCondition:(int)condition;
// init & set condition variable
- (int)condition;
- (void)lockWhenCondition:(int)condition;
// acquire lock when conditionVar == condition
- (BOOL)tryLock;
/* Returns YES iff lock acquired; returns immediately */
- (BOOL)tryLockWhenCondition:(int)condition;
// acquire lock when conditionVar == condition
- (void)unlockWithCondition:(int)condition;
// release lock and update conditionVar
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.