xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdClient
XrdClientInputBuffer.hh
Go to the documentation of this file.
1
2
// //
3
// XrdClientInputBuffer //
4
// //
5
// Author: Fabrizio Furano (INFN Padova, 2004) //
6
// Adapted from TXNetFile (root.cern.ch) originally done by //
7
// Alvise Dorigo, Fabrizio Furano //
8
// INFN Padova, 2003 //
9
// //
10
// Buffer for incoming messages (responses) //
11
// Handles the waiting (with timeout) for a message to come //
12
// belonging to a logical streamid //
13
// Multithread friendly //
14
// //
16
17
// $Id$
18
19
#ifndef XRC_INPUTBUFFER_H
20
#define XRC_INPUTBUFFER_H
21
22
23
#include "
XrdClient/XrdClientMessage.hh
"
24
#include "
XrdSys/XrdSysPthread.hh
"
25
#include "
XrdSys/XrdSysSemWait.hh
"
26
#include "
XrdOuc/XrdOucHash.hh
"
27
#include "
XrdClient/XrdClientVector.hh
"
28
29
using namespace
std;
30
31
class
XrdClientInputBuffer
{
32
33
private
:
34
35
XrdClientVector<XrdClientMessage*>
fMsgQue
;
// queue for incoming messages
36
int
fMsgIter
;
// an iterator on it
37
38
XrdSysRecMutex
fMutex
;
// mutex to protect data structures
39
40
XrdOucHash<XrdSysSemWait>
fSyncobjRepo
;
41
// each streamid counts on a condition
42
// variable to make the caller wait
43
// until some data is available
44
45
46
XrdSysSemWait
*GetSyncObjOrMakeOne(
int
streamid);
47
48
int
MsgForStreamidCnt(
int
streamid);
49
50
public
:
51
XrdClientInputBuffer
();
52
~
XrdClientInputBuffer
();
53
54
inline
bool
IsMexEmpty
() {
return
(MexSize() == 0); }
55
inline
bool
IsSemEmpty
() {
return
(SemSize() == 0); }
56
inline
int
MexSize
() {
57
XrdSysMutexHelper
mtx(fMutex);
58
return
fMsgQue.GetSize();
59
}
60
int
PutMsg(
XrdClientMessage
*msg);
61
inline
int
SemSize
() {
62
XrdSysMutexHelper
mtx(fMutex);
63
return
fSyncobjRepo.Num();
64
}
65
66
int
WipeStreamid(
int
streamid);
67
68
XrdClientMessage
*GetMsg(
int
streamid,
int
secstimeout);
69
};
70
71
72
73
#endif
Generated by
1.8.1.2