xrootd
XrdPosixCallBack.hh
Go to the documentation of this file.
1 #ifndef __POSIX_CALLBACK_HH__
2 #define __POSIX_CALLBACK_HH__
3 /******************************************************************************/
4 /* */
5 /* X r d P o s i x C a l l B a c k . h h */
6 /* */
7 /* (c) 2010 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC02-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 // $Id$
14 
15 // This abstract class defines the callback interface for file open() calls.
16 // It is passed when using the XrdPosixXrootd::Open() call. When passed, the
17 // open request will be done in the background. When a callback object is
18 // supplied, Open() will *always* return -1. However, if started successfully,
19 // Open() will return -1 with errno set to EINPROGRESS. Otherwise, errno will
20 // contain the reason the Open() request immediately failed. Upon completion,
21 // the callback's Compete() method is invoked. The Result parameter will either
22 // be a non-negative file descriptor or -errno indicating that the Open()
23 // failed. Note that the caller is responsible for deleting the callback object
24 // after it has been invoked. Note that callbacks will be executed in a
25 // separate thread unless open() is called with O_SYNC or maxThreads is zero.
26 // WARNING: If O_SYNC or maxThreads is zero, then the callback must *not*
27 // issue any filesystem calls using the supplied file descriptor.
28 // Ignoring this will produce undetermined results including possible
29 // deadlock. Synchrnous callbacks are only meant to support private
30 // thread management.
31 
33 {
34 public:
35 
36 virtual void Complete(int Result) = 0;
37 
39 virtual ~XrdPosixCallBack() {}
40 };
41 #endif