Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please consider the following formatting changes to #12200 #228

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Framework/Core/include/Framework/DeviceContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#define O2_FRAMEWORK_DEVICECONTEXT_H_

typedef struct uv_timer_s uv_timer_t;
typedef struct uv_signal_s uv_signal_t;

namespace o2::framework
{
Expand All @@ -27,6 +28,7 @@ struct ComputingQuotaStats;
struct DeviceContext {
ComputingQuotaStats* quotaStats = nullptr;
uv_timer_t* gracePeriodTimer = nullptr;
uv_signal_t* sigusr1Handle = nullptr;
int expectedRegionCallbacks = 0;
int exitTransitionTimeout = 0;
};
Expand Down
15 changes: 11 additions & 4 deletions Framework/Core/src/DataProcessingDevice.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -972,10 +972,12 @@ void DataProcessingDevice::InitTask()
// an event from the outside, making sure that the event loop can
// be unblocked (e.g. by a quitting DPL driver) even when there
// is no data pending to be processed.
auto* sigusr1Handle = (uv_signal_t*)malloc(sizeof(uv_signal_t));
uv_signal_init(state.loop, sigusr1Handle);
sigusr1Handle->data = &mServiceRegistry;
uv_signal_start(sigusr1Handle, on_signal_callback, SIGUSR1);
if (deviceContext.sigusr1Handle == nullptr) {
deviceContext.sigusr1Handle = (uv_signal_t*)malloc(sizeof(uv_signal_t));
deviceContext.sigusr1Handle->data = &mServiceRegistry;
uv_signal_init(state.loop, deviceContext.sigusr1Handle);
}
uv_signal_start(deviceContext.sigusr1Handle, on_signal_callback, SIGUSR1);

/// Initialise the pollers
DataProcessingDevice::initPollers();
Expand Down Expand Up @@ -1675,6 +1677,11 @@ void DataProcessingDevice::ResetTask()
{
ServiceRegistryRef ref{mServiceRegistry};
ref.get<DataRelayer>().clear();
auto& deviceContext = ref.get<DeviceContext>();
// Stop the signal handler
if (deviceContext.sigusr1Handle) {
uv_signal_stop(deviceContext.sigusr1Handle);
}
}

struct WaitBackpressurePolicy {
Expand Down