xrootd
|
00001 #ifndef __XRDOSS_LOCK__ 00002 #define __XRDOSS_LOCK__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d O s s L o c k . h h */ 00006 /* */ 00007 /* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */ 00008 /* All Rights Reserved */ 00009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 00010 /* DE-AC03-76-SFO0515 with the Department of Energy */ 00011 /******************************************************************************/ 00012 00013 // $Id$ 00014 00015 class XrdOssLock 00016 { 00017 public: 00018 00019 int Serialize(const char *, int); 00020 int Serialize(int lkFD, int Opt) {return XLock(lkFD, Opt);} 00021 int NoSerialize(const char *, int); 00022 int ReSerialize(const char *, const char *); 00023 int UnSerialize(int opts=0); 00024 00025 XrdOssLock() {lkfd = -1;} 00026 ~XrdOssLock() {if (lkfd >= 0) UnSerialize();} 00027 00028 private: 00029 00030 int lkfd; // Lock file handle 00031 00032 int XLock(int, int); 00033 int Build_LKFN(char *, int, const char *, int); 00034 }; 00035 00036 /******************************************************************************/ 00037 /* C a l l i n g O p t i o n s */ 00038 /******************************************************************************/ 00039 00040 // Defines when calling XrdOssSerialize() and XrdOssUnSerialize() 00041 // 00042 #define XrdOssLEAVE 0x00000001 00043 #define XrdOssRETRY 0x00000002 00044 #define XrdOssREGRADE 0x00000004 00045 #define XrdOssNOWAIT 0x00000008 00046 #define XrdOssEXC 0x00000010 00047 #define XrdOssSHR 0x00000020 00048 #define XrdOssDIR 0x00000040 00049 #define XrdOssFILE 0x00000080 00050 #define XrdOssRETIME 0x00000100 00051 00052 #endif