Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TSysEvtHandler.cxx
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Fons Rademakers 16/09/95
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TSysEvtHandler
13\ingroup Base
14
15Abstract base class for handling system events.
16*/
17
18#include "TSysEvtHandler.h"
19#include "TSystem.h"
20
21
22
23
24////////////////////////////////////////////////////////////////////////////////
25/// Activate a system event handler. All handlers are by default
26/// activated. Use this method to activate a de-activated handler.
27
29{
31 Activated(); // emit Activated() signal
32}
33
34////////////////////////////////////////////////////////////////////////////////
35/// De-activate a system event handler. Use this method to temporarily
36/// disable an event handler to avoid it from being recursively called.
37/// Use DeActivate() / Activate() instead of Remove() / Add() for this
38/// purpose, since the Add() will add the handler back to the end of
39/// the list of handlers and cause it to be called again for the same,
40/// already handled, event.
41
43{
45 DeActivated(); // emit DeActivated() signal
46}
47
48
49////////////////////////////////////////////////////////////////////////////////
50/// Create a file descriptor event handler. If mask=kRead then we
51/// want to monitor the file for read readiness, if mask=kWrite
52/// then we monitor the file for write readiness, if mask=kRead|kWrite
53/// then we monitor both read and write readiness.
54
56{
57 fFileNum = fd;
58 if (!mask)
59 mask = kRead;
60 fMask = mask;
61 fReadyMask = 0;
62}
63
64////////////////////////////////////////////////////////////////////////////////
65/// Notify when event occurred on descriptor associated with this handler.
66
68{
69 Notified(); // emit Notified() signal
70 return kFALSE;
71}
72
73////////////////////////////////////////////////////////////////////////////////
74/// Notify when something can be read from the descriptor associated with
75/// this handler.
76
78{
79 Notified(); // emit Notified() signal
80 return kFALSE;
81}
82
83////////////////////////////////////////////////////////////////////////////////
84/// Notify when something can be written to the descriptor associated with
85/// this handler.
86
88{
89 Notified(); // emit Notified() signal
90 return kFALSE;
91}
92
93////////////////////////////////////////////////////////////////////////////////
94/// True if handler is interested in read events.
95
97{
98 return (fMask & 1);
99}
100
101////////////////////////////////////////////////////////////////////////////////
102/// True if handler is interested in write events.
103
105{
106 return (fMask & 2);
107}
108
109////////////////////////////////////////////////////////////////////////////////
110/// Set interest mask to 'mask'.
111
113{
114 if (!mask)
115 mask = kRead;
116 fMask = mask;
117}
118
119////////////////////////////////////////////////////////////////////////////////
120/// Add file event handler to system file handler list.
121
123{
124 if (gSystem && fFileNum != -1) {
125 gSystem->AddFileHandler(this);
126 Added(); // emit Added() signal
127 }
128}
129
130////////////////////////////////////////////////////////////////////////////////
131/// Remove file event handler from system file handler list.
132
134{
135 if (gSystem && fFileNum != -1) {
137 Removed(); // emit Removed() signal
138 }
139}
140
141
142////////////////////////////////////////////////////////////////////////////////
143/// Create signal event handler.
144
146{
147 fSignal = sig;
148 fSync = sync;
149 fDelay = 0;
150}
151
152////////////////////////////////////////////////////////////////////////////////
153/// Notify when signal occurs.
154
156{
157 Notified(); // emit Notified() signal
158 return kFALSE;
159}
160
161////////////////////////////////////////////////////////////////////////////////
162/// Add signal handler to system signal handler list.
163
165{
166 if (gSystem && fSignal != (ESignals)-1) {
168 Added(); // emit Added() signal
169 }
170}
171
172////////////////////////////////////////////////////////////////////////////////
173/// Remove signal handler from system signal handler list.
174
176{
177 if (gSystem && fSignal != (ESignals)-1) {
179 Removed(); // emit Removed() signal
180 }
181}
182
183
184////////////////////////////////////////////////////////////////////////////////
185/// Handle standard C++ exceptions intercepted by the TSystem::Run().
186///
187/// Virtual method EStatus Handle(std::exception& exc) is called on the
188/// collection of handlers registered to TSystem. The return value of
189/// each handler influences the continuation of handling procedure:
190/// - kSEProceed - Proceed with passing of the exception to other
191/// handlers, the exception has not been handled.
192/// - kSEHandled - The exception has been handled, do not pass it to
193/// other handlers.
194/// - kSEAbort - Abort application.
195/// If all handlers return kSEProceed TSystem::Run() rethrows the
196/// exception, possibly resulting in process abortion.
197
201
202////////////////////////////////////////////////////////////////////////////////
203/// Add std::exception handler to system handler list.
204
206{
207 if (gSystem) {
209 Added(); // emit Added() signal
210 }
211}
212
213////////////////////////////////////////////////////////////////////////////////
214/// Remove std::exception handler from system handler list.
215
217{
218 if (gSystem) {
220 Removed(); // emit Removed() signal
221 }
222}
223
224////////////////////////////////////////////////////////////////////////////////
225/// Notify when signal occurs.
226
228{
229 Notified(); // emit Notified() signal
230 return kFALSE;
231}
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
ESignals
R__EXTERN TSystem * gSystem
Definition TSystem.h:572
virtual void SetInterest(Int_t mask)
Set interest mask to 'mask'.
virtual Bool_t HasReadInterest()
True if handler is interested in read events.
void Remove() override
Remove file event handler from system file handler list.
virtual Bool_t WriteNotify()
Notify when something can be written to the descriptor associated with this handler.
virtual Bool_t HasWriteInterest()
True if handler is interested in write events.
void Add() override
Add file event handler to system file handler list.
virtual Bool_t ReadNotify()
Notify when something can be read from the descriptor associated with this handler.
Bool_t Notify() override
Notify when event occurred on descriptor associated with this handler.
void Add() override
Add signal handler to system signal handler list.
Bool_t Notify() override
Notify when signal occurs.
void Remove() override
Remove signal handler from system signal handler list.
TStdExceptionHandler()
Handle standard C++ exceptions intercepted by the TSystem::Run().
void Add() override
Add std::exception handler to system handler list.
Bool_t Notify() override
Notify when signal occurs.
void Remove() override
Remove std::exception handler from system handler list.
Abstract base class for handling system events.
void DeActivate()
De-activate a system event handler.
virtual void Added()
virtual void Notified()
virtual void Removed()
void Activate()
Activate a system event handler.
virtual void DeActivated()
virtual void Activated()
virtual void AddFileHandler(TFileHandler *fh)
Add a file handler to the list of system file handlers.
Definition TSystem.cxx:552
virtual TStdExceptionHandler * RemoveStdExceptionHandler(TStdExceptionHandler *eh)
Remove an exception handler from list of exception handlers.
Definition TSystem.cxx:619
virtual TFileHandler * RemoveFileHandler(TFileHandler *fh)
Remove a file handler from the list of file handlers.
Definition TSystem.cxx:562
virtual void AddSignalHandler(TSignalHandler *sh)
Add a signal handler to list of system signal handlers.
Definition TSystem.cxx:530
virtual void AddStdExceptionHandler(TStdExceptionHandler *eh)
Add an exception handler to list of system exception handlers.
Definition TSystem.cxx:609
virtual TSignalHandler * RemoveSignalHandler(TSignalHandler *sh)
Remove a signal handler from list of signal handlers.
Definition TSystem.cxx:540