xrootd
Main Page
Namespaces
Classes
Files
File List
File Members
src
XrdClient
XrdClientThread.hh
Go to the documentation of this file.
1
2
// //
3
// XrdClientThread //
4
// //
5
// An user friendly thread wrapper //
6
// Author: F.Furano (INFN, 2005) //
7
// //
9
10
// $Id$
11
12
#ifndef XRC_THREAD_H
13
#define XRC_THREAD_H
14
15
#include "
XrdSys/XrdSysPthread.hh
"
16
17
void
*
XrdClientThreadDispatcher
(
void
* arg);
18
19
class
XrdClientThread
{
20
private
:
21
pthread_t
fThr
;
22
23
typedef
void
*(*VoidRtnFunc_t)(
void
*,
XrdClientThread
*);
24
VoidRtnFunc_t
ThreadFunc
;
25
friend
void
*
XrdClientThreadDispatcher
(
void
*);
26
27
public
:
28
struct
XrdClientThreadArgs
{
29
void
*
arg
;
30
XrdClientThread
*
threadobj
;
31
}
fArg
;
32
33
34
XrdClientThread
(
VoidRtnFunc_t
fn) {
35
#ifndef WIN32
36
fThr
= 0;
37
#endif
38
ThreadFunc
= fn;
39
};
40
41
virtual
~XrdClientThread
() {
42
43
// Cancel();
44
};
45
46
int
Cancel
() {
47
return
XrdSysThread::Cancel
(
fThr
);
48
};
49
50
int
Run
(
void
*arg = 0) {
51
fArg
.
arg
= arg;
52
fArg
.
threadobj
=
this
;
53
return
XrdSysThread::Run
(&
fThr
,
XrdClientThreadDispatcher
, (
void
*)&
fArg
,
54
XRDSYSTHREAD_HOLD
,
""
);
55
};
56
57
int
Detach
() {
58
return
XrdSysThread::Detach
(
fThr
);
59
};
60
61
int
Join
(
void
**ret = 0) {
62
return
XrdSysThread::Join
(
fThr
, ret);
63
};
64
65
// these funcs are to be called only from INSIDE the thread loop
66
int
SetCancelOn
() {
67
return
XrdSysThread::SetCancelOn
();
68
};
69
int
SetCancelOff
() {
70
return
XrdSysThread::SetCancelOff
();
71
};
72
int
SetCancelAsynchronous
() {
73
return
XrdSysThread::SetCancelAsynchronous
();
74
};
75
int
SetCancelDeferred
() {
76
return
XrdSysThread::SetCancelDeferred
();
77
};
78
void
CancelPoint
() {
79
XrdSysThread::CancelPoint
();
80
};
81
82
int
MaskSignal
(
int
snum = 0,
bool
block = 1);
83
};
84
85
86
87
#endif
Generated by
1.8.1.2