xrootd

XrdFrmXLock.hh

Go to the documentation of this file.
00001 #ifndef __FRMXLOCK_HH__
00002 #define __FRMXLOCK_HH__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                        X r d F r m X L o c k . h h                         */
00006 /*                                                                            */
00007 /* (c) 2010 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-AC02-76-SFO0515 with the Department of Energy              */
00011 /******************************************************************************/
00012 
00013 #include "XrdOuc/XrdOucSxeq.hh"
00014   
00015 class XrdFrmXLock
00016 {
00017 public:
00018 
00019 static int Init(const char *aPath)
00020                {XrdOucSxeq mySxeq(".frmxeq", 0, aPath);
00021                 return ((lkFD = mySxeq.Detach()) >= 0);
00022                }
00023 
00024            XrdFrmXLock() {XrdOucSxeq::Serialize(lkFD, 0);}
00025           ~XrdFrmXLock() {XrdOucSxeq::Release(lkFD);}
00026 
00027 private:
00028 
00029 static int lkFD;
00030 };
00031 
00032 #ifndef __FRMXLOCK_CC__
00033 #define __FRMXLOCK_CC__
00034 int XrdFrmXLock::lkFD = -1;
00035 #endif
00036 
00037 #endif