Skip to content

Commit c6199d0

Browse files
committed
DPL: do not allocate handle in separate thread
1 parent b80c66b commit c6199d0

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Framework/Core/src/DataProcessingDevice.cxx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -262,20 +262,20 @@ void DataProcessingDevice::Init()
262262
mState.inputChannelInfos[ci].state = InputChannelState::Pull;
263263
}
264264
}
265+
uv_async_t* wakeHandle = (uv_async_t*)malloc(sizeof(uv_async_t));
266+
assert(mState.loop);
267+
int res = uv_async_init(mState.loop, wakeHandle, nullptr);
268+
if (res < 0) {
269+
LOG(ERROR) << "Unable to initialise subscription";
270+
}
271+
265272
/// This should post a message on the queue...
266-
SubscribeToNewTransition("dpl", [loop = mState.loop](fair::mq::Transition t) {
267-
if (loop) {
268-
uv_async_t handle;
269-
int res = uv_async_init(loop, &handle, nullptr);
270-
if (res < 0) {
271-
LOG(ERROR) << "Unable to initialise subscription";
272-
}
273-
res = uv_async_send(&handle);
274-
if (res < 0) {
275-
LOG(ERROR) << "Unable to notify subscription";
276-
}
277-
LOG(debug) << "State transition requested";
273+
SubscribeToNewTransition("dpl", [wakeHandle](fair::mq::Transition t) {
274+
int res = uv_async_send(wakeHandle);
275+
if (res < 0) {
276+
LOG(ERROR) << "Unable to notify subscription";
278277
}
278+
LOG(debug) << "State transition requested";
279279
});
280280
}
281281

0 commit comments

Comments
 (0)