Skip to content

Commit

Permalink
More race conditions for exit 128
Browse files Browse the repository at this point in the history
  • Loading branch information
ktf committed Nov 10, 2023
1 parent bfa7c72 commit adaabd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Framework/Core/src/DataProcessingDevice.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,10 @@ void DataProcessingDevice::InitTask()
uv_signal_init(state.loop, deviceContext.sigusr1Handle);
uv_signal_start(deviceContext.sigusr1Handle, on_signal_callback, SIGUSR1);
}
// If there is any signal, we want to make sure they are active
for (auto& handle : state.activeSignals) {
handle->data = &state;
}
// When we start, we must make sure that we do listen to the signal
deviceContext.sigusr1Handle->data = &mServiceRegistry;

Expand Down Expand Up @@ -1691,6 +1695,11 @@ void DataProcessingDevice::ResetTask()
if (deviceContext.sigusr1Handle) {
deviceContext.sigusr1Handle->data = nullptr;
}
// Makes sure we do not have a working context on
// shutdown.
for (auto& handle : ref.get<DeviceState>().activeSignals) {
handle->data = nullptr;
}
}

struct WaitBackpressurePolicy {
Expand Down
3 changes: 3 additions & 0 deletions Framework/Core/src/DeviceSpecHelpers.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ void signal_callback(uv_signal_t* handle, int)
{
// We simply wake up the event loop. Nothing to be done here.
auto* state = (DeviceState*)handle->data;
if (!state) {
return;
}
state->loopReason |= DeviceState::SIGNAL_ARRIVED;
state->loopReason |= DeviceState::DATA_INCOMING;
}
Expand Down

0 comments on commit adaabd2

Please sign in to comment.