From 6784dbc203d75f6c27a627ebab69abb57fb1fbb8 Mon Sep 17 00:00:00 2001 From: Matti Kortelainen Date: Thu, 25 Jul 2024 19:50:29 +0200 Subject: [PATCH] Mark ScopedContextAcquire destructor as noexcept(false) This destructor can throw an exception that is wanted to be propagated upwards in the stack, even with the risk of double exceptions (and those leading to std::terminate()). --- HeterogeneousCore/CUDACore/interface/ScopedContext.h | 2 +- HeterogeneousCore/CUDACore/src/ScopedContext.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HeterogeneousCore/CUDACore/interface/ScopedContext.h b/HeterogeneousCore/CUDACore/interface/ScopedContext.h index e2d55577d2a02..ec0b8c4a3f897 100644 --- a/HeterogeneousCore/CUDACore/interface/ScopedContext.h +++ b/HeterogeneousCore/CUDACore/interface/ScopedContext.h @@ -120,7 +120,7 @@ namespace cms { ContextState& state) : ScopedContextGetterBase(data), holderHelper_{std::move(waitingTaskHolder)}, contextState_{&state} {} - ~ScopedContextAcquire(); + ~ScopedContextAcquire() noexcept(false); template void pushNextTask(F&& f) { diff --git a/HeterogeneousCore/CUDACore/src/ScopedContext.cc b/HeterogeneousCore/CUDACore/src/ScopedContext.cc index 68e0f869bf3d2..726bd00bf1757 100644 --- a/HeterogeneousCore/CUDACore/src/ScopedContext.cc +++ b/HeterogeneousCore/CUDACore/src/ScopedContext.cc @@ -68,7 +68,7 @@ namespace cms::cuda { //////////////////// - ScopedContextAcquire::~ScopedContextAcquire() { + ScopedContextAcquire::~ScopedContextAcquire() noexcept(false) { holderHelper_.enqueueCallback(device(), stream()); if (contextState_) { contextState_->set(device(), streamPtr());