|
|
|||
Warning, file /include/xrootd/XrdPosix/XrdPosixCallBack.hh was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #ifndef __POSIX_CALLBACK_HH__ 0002 #define __POSIX_CALLBACK_HH__ 0003 /******************************************************************************/ 0004 /* */ 0005 /* X r d P o s i x C a l l B a c k . h h */ 0006 /* */ 0007 /* (c) 2016 by the Board of Trustees of the Leland Stanford, Jr., University */ 0008 /* All Rights Reserved */ 0009 /* Produced by Andrew Hanushevsky for Stanford University under contract */ 0010 /* DE-AC02-76-SFO0515 with the Department of Energy */ 0011 /* */ 0012 /* This file is part of the XRootD software suite. */ 0013 /* */ 0014 /* XRootD is free software: you can redistribute it and/or modify it under */ 0015 /* the terms of the GNU Lesser General Public License as published by the */ 0016 /* Free Software Foundation, either version 3 of the License, or (at your */ 0017 /* option) any later version. */ 0018 /* */ 0019 /* XRootD is distributed in the hope that it will be useful, but WITHOUT */ 0020 /* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */ 0021 /* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */ 0022 /* License for more details. */ 0023 /* */ 0024 /* You should have received a copy of the GNU Lesser General Public License */ 0025 /* along with XRootD in a file called COPYING.LESSER (LGPL license) and file */ 0026 /* COPYING (GPL license). If not, see <http://www.gnu.org/licenses/>. */ 0027 /* */ 0028 /* The copyright holder's institutional names and contributor's names may not */ 0029 /* be used to endorse or promote products derived from this software without */ 0030 /* specific prior written permission of the institution or contributor. */ 0031 /******************************************************************************/ 0032 0033 #include "XrdOuc/XrdOucCache.hh" 0034 0035 //----------------------------------------------------------------------------- 0036 //! @brief An abstract class to define a callback for Open() call. 0037 //! 0038 //! This abstract class defines the callback interface for Open() calls. 0039 //! When passed, the request is done in the background. When a callback 0040 //! object is supplied, the method *always* return -1. However, if started 0041 //! successfully, the method sets errno to EINPROGRESS. Otherwise, errno 0042 //! contain the reason the request immediately failed. Upon completion, the 0043 //! the callback's Compete() method is invoked. The Result parameter contains 0044 //! what the method would have returned if it were executed synchronously: 0045 //! for succsessful Open() it is a non-negative file descriptor but on failure 0046 //! -1 with errno indicating why Open() failed. The caller is responsible for 0047 //! deleting the callback object after it has been invoked. Callbacks are 0048 //! executed in a separate thread. 0049 //----------------------------------------------------------------------------- 0050 0051 class XrdPosixCallBack 0052 { 0053 public: 0054 0055 virtual void Complete(int Result) = 0; 0056 0057 XrdPosixCallBack() {} 0058 virtual ~XrdPosixCallBack() {} 0059 }; 0060 0061 //----------------------------------------------------------------------------- 0062 //! @brief An abstract class to define a callback for file I/O requests. 0063 //! 0064 //! This abstract class defines the callback interface for Fsync(), Pread(), 0065 //! Pwrite(), and VRead(). Async I/O is not supported for Read(), Readv(), 0066 //! Write(), and Writev() as these update the file offset associated with the 0067 //! file descriptor and cannot be made async safe. All results are return via 0068 //! the callback object. For immediate errors, the callback is invoked on the 0069 //! calling thread. Any locks held by the calling thread that are obtained by 0070 //! the callback must be recursive locks in order to avoid a deadlock. 0071 //----------------------------------------------------------------------------- 0072 0073 class XrdPosixFile; 0074 0075 class XrdPosixCallBackIO : public XrdOucCacheIOCB 0076 { 0077 public: 0078 friend class XrdPosixExtra; 0079 friend class XrdPosixXrootd; 0080 0081 virtual void Complete(ssize_t Result) = 0; 0082 0083 XrdPosixCallBackIO() : theFile(0) {} 0084 virtual ~XrdPosixCallBackIO() {} 0085 0086 private: 0087 0088 void Done(int result); 0089 0090 XrdPosixFile *theFile; 0091 }; 0092 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|