Skip to content

Commit 7932b9f

Browse files
committed
making introspection holdoff timout more configurable and longer
1 parent 8129d3f commit 7932b9f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

IntelPresentMon/Interprocess/source/Interprocess.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ namespace pmon::ipc
134134
:
135135
shm_{ bip::open_only, sharedMemoryName.value_or(defaultSegmentName_).c_str() }
136136
{}
137-
const PM_INTROSPECTION_ROOT* GetIntrospectionRoot() override
137+
const PM_INTROSPECTION_ROOT* GetIntrospectionRoot(uint32_t timeoutMs) override
138138
{
139139
// make sure holdoff semaphore has been released
140-
WaitOnIntrospectionHoldoff_();
140+
WaitOnIntrospectionHoldoff_(timeoutMs);
141141
// acquire shared lock on introspection data
142142
auto sharedLock = LockIntrospectionMutexForShare_();
143143
// find the introspection structure in shared memory
@@ -157,7 +157,7 @@ namespace pmon::ipc
157157
}
158158
private:
159159
// functions
160-
void WaitOnIntrospectionHoldoff_()
160+
void WaitOnIntrospectionHoldoff_(uint32_t timeoutMs)
161161
{
162162
using namespace std::chrono_literals;
163163
using clock = std::chrono::high_resolution_clock;
@@ -167,7 +167,7 @@ namespace pmon::ipc
167167
}
168168
auto& sem = *result.first;
169169
// wait for holdoff to be released (timeout after XXXms)
170-
if (!sem.timed_wait(clock::now() + 750ms)) {
170+
if (!sem.timed_wait(clock::now() + 1ms * timeoutMs)) {
171171
throw std::runtime_error{ "timeout accessing introspection" };
172172
}
173173
// return the slot we just took because holdoff should not limit entry once released

IntelPresentMon/Interprocess/source/Interprocess.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ namespace pmon::ipc
2929
{
3030
public:
3131
virtual ~MiddlewareComms() = default;
32-
virtual const PM_INTROSPECTION_ROOT* GetIntrospectionRoot() = 0;
32+
virtual const PM_INTROSPECTION_ROOT* GetIntrospectionRoot(uint32_t timeoutMs = 2000) = 0;
3333
};
3434

3535
std::unique_ptr<ServiceComms> MakeServiceComms(std::optional<std::string> sharedMemoryName = {});

0 commit comments

Comments
 (0)