1 /* Interface for NSDistributedLock for GNUStep 2 Copyright (C) 1997 Free Software Foundation, Inc. 3 4 Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk> 5 Date: 1997 6 7 This file is part of the GNUstep Base Library. 8 9 This library is free software; you can redistribute it and/or 10 modify it under the terms of the GNU Lesser General Public 11 License as published by the Free Software Foundation; either 12 version 2 of the License, or (at your option) any later version. 13 14 This library is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 Lesser General Public License for more details. 18 19 You should have received a copy of the GNU Lesser General Public 20 License along with this library; if not, write to the Free 21 Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 Boston, MA 02110 USA. 23 */ 24 25 #ifndef __NSDistributedLock_h_GNUSTEP_BASE_INCLUDE 26 #define __NSDistributedLock_h_GNUSTEP_BASE_INCLUDE 27 #import <GNUstepBase/GSVersionMacros.h> 28 29 #import <Foundation/NSObject.h> 30 31 @class NSDate; 32 @class NSLock; 33 @class NSString; 34 35 #if defined(__cplusplus) 36 extern "C" { 37 #endif 38 39 @interface NSDistributedLock : NSObject 40 { 41 #if GS_EXPOSE(NSDistributedLock) 42 NSString *_lockPath; 43 NSDate *_lockTime; 44 NSLock *_localLock; 45 #endif 46 #if GS_NONFRAGILE 47 #else 48 /* Pointer to private additional data used to avoid breaking ABI 49 * when we don't have the non-fragile ABI available. 50 * Use this mechanism rather than changing the instance variable 51 * layout (see Source/GSInternal.h for details). 52 */ 53 @private id _internal GS_UNUSED_IVAR; 54 #endif 55 } 56 57 + (NSDistributedLock*) lockWithPath: (NSString*)aPath; 58 - (id) initWithPath: (NSString*)aPath; 59 60 - (void) breakLock; 61 - (NSDate*) lockDate; 62 - (BOOL) tryLock; 63 - (void) unlock; 64 65 @end 66 67 #if defined(__cplusplus) 68 } 69 #endif 70 71 #endif /* __NSDistributedLock_h_GNUSTEP_BASE_INCLUDE */ 72