mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 17:41:05 +00:00
Header reorganizsateion - Please refer to ChangeLog
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@17407 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9cc6c39319
commit
ac30183cd6
238 changed files with 694 additions and 544 deletions
131
Headers/Foundation/NSLock.h
Normal file
131
Headers/Foundation/NSLock.h
Normal file
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
NSLock.h
|
||||
|
||||
Definitions for locking protocol and classes
|
||||
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
|
||||
Author: Scott Christley <scottc@net-community.com>
|
||||
Date: 1996
|
||||
|
||||
This file is part of the GNUstep Objective-C Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
If you are interested in a warranty or support for this source code,
|
||||
contact Scott Christley <scottc@net-community.com> for more information.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
|
||||
#ifndef _GNUstep_H_NSLock
|
||||
#define _GNUstep_H_NSLock
|
||||
|
||||
#include <Foundation/NSObject.h>
|
||||
#ifdef NeXT_RUNTIME
|
||||
#include <GNUstepBase/thr-mach.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* NSLocking protocol
|
||||
*/
|
||||
@protocol NSLocking
|
||||
|
||||
- (void) lock;
|
||||
- (void) unlock;
|
||||
|
||||
@end
|
||||
|
||||
/*
|
||||
* NSLock class
|
||||
* Simplest lock for protecting critical sections of code
|
||||
*/
|
||||
@interface NSLock : NSObject <NSLocking, GCFinalization>
|
||||
{
|
||||
@private
|
||||
objc_mutex_t _mutex;
|
||||
}
|
||||
|
||||
- (BOOL) tryLock;
|
||||
- (BOOL) lockBeforeDate: (NSDate*)limit;
|
||||
|
||||
- (void) lock;
|
||||
- (void) unlock;
|
||||
|
||||
@end
|
||||
|
||||
/*
|
||||
* NSConditionLock
|
||||
* Allows locking and unlocking to be based upon a condition
|
||||
*/
|
||||
@interface NSConditionLock : NSObject <NSLocking, GCFinalization>
|
||||
{
|
||||
@private
|
||||
objc_condition_t _condition;
|
||||
objc_mutex_t _mutex;
|
||||
int _condition_value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize lock with condition
|
||||
*/
|
||||
- (id) initWithCondition: (int)value;
|
||||
|
||||
/*
|
||||
* Return the current condition of the lock
|
||||
*/
|
||||
- (int) condition;
|
||||
|
||||
/*
|
||||
* Acquiring and release the lock
|
||||
*/
|
||||
- (void) lockWhenCondition: (int)value;
|
||||
- (void) unlockWithCondition: (int)value;
|
||||
- (BOOL) tryLock;
|
||||
- (BOOL) tryLockWhenCondition: (int)value;
|
||||
|
||||
/*
|
||||
* Acquiring the lock with a date condition
|
||||
*/
|
||||
- (BOOL) lockBeforeDate: (NSDate*)limit;
|
||||
- (BOOL) lockWhenCondition: (int)condition_to_meet
|
||||
beforeDate: (NSDate*)limitDate;
|
||||
|
||||
- (void) lock;
|
||||
- (void) unlock;
|
||||
|
||||
@end
|
||||
|
||||
/*
|
||||
* NSRecursiveLock
|
||||
* Allows the lock to be recursively acquired by the same thread
|
||||
*
|
||||
* If the same thread locks the mutex (n) times then that same
|
||||
* thread must also unlock it (n) times before another thread
|
||||
* can acquire the lock.
|
||||
*/
|
||||
@interface NSRecursiveLock : NSObject <NSLocking, GCFinalization>
|
||||
{
|
||||
@private
|
||||
objc_mutex_t _mutex;
|
||||
}
|
||||
|
||||
- (BOOL) tryLock;
|
||||
- (BOOL) lockBeforeDate: (NSDate*)limit;
|
||||
|
||||
- (void) lock;
|
||||
- (void) unlock;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* _GNUstep_H_NSLock*/
|
Loading…
Add table
Add a link
Reference in a new issue