ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
HLT
Trigger
TrigControl
TrigServices
src
TrigServicesUtils.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#ifndef TRIGSERVICES_TRIGSERVICESUTILS_H
6
#define TRIGSERVICES_TRIGSERVICESUTILS_H
7
8
#include <algorithm>
9
#include <atomic>
10
#include <chrono>
11
#include <thread>
12
14
#define NOSUPPORT(lvl, what) \
15
do { \
16
ATH_MSG_LVL(MSG::lvl, what << " is not supported by this implementation"); \
17
return {}; \
18
} while (0)
19
20
#define NOSUPPORT_VOID(lvl, what) \
21
do { \
22
ATH_MSG_LVL(MSG::lvl, what << " is not supported by this implementation"); \
23
return; \
24
} while (0)
25
27
namespace
TrigServices
{
28
30
inline
void
conditionedSleep
(std::chrono::milliseconds duration,
31
const
std::atomic<bool>& stopFlag)
32
{
33
const
auto
start = std::chrono::steady_clock::now();
34
while
(
true
) {
35
if
(stopFlag.load()) {
36
return
;
37
}
38
const
auto
elapsed = std::chrono::steady_clock::now() - start;
39
if
(elapsed >= duration) {
40
break
;
41
}
42
const
auto
remaining = duration - std::chrono::duration_cast<std::chrono::milliseconds>(elapsed);
43
std::this_thread::sleep_for(std::min(std::chrono::milliseconds(500), remaining));
44
}
45
}
46
47
}
48
49
#endif
// TRIGSERVICES_TRIGSERVICESUTILS_H
TrigServices
Helpers shared by monitoring services.
Definition
TrigServicesUtils.h:27
TrigServices::conditionedSleep
void conditionedSleep(std::chrono::milliseconds duration, const std::atomic< bool > &stopFlag)
Sleep for duration or until stopFlag is set, whichever comes first.
Definition
TrigServicesUtils.h:30
Generated on
for ATLAS Offline Software by
1.17.0