Call IProcessor::onCancel() once

This commit is contained in:
Igor Nikonov 2023-04-12 10:04:31 +00:00
parent 438cd4af09
commit 943f9f541b

View File

@ -237,11 +237,12 @@ public:
/// In case if query was cancelled executor will wait till all processors finish their jobs.
/// Generally, there is no reason to check this flag. However, it may be reasonable for long operations (e.g. i/o).
bool isCancelled() const { return is_cancelled; }
bool isCancelled() const { return is_cancelled.load(std::memory_order_acquire); }
void cancel()
{
is_cancelled = true;
onCancel();
bool already_cancelled = is_cancelled.exchange(true, std::memory_order_acq_rel);
if (!already_cancelled)
onCancel();
}
/// Additional method which is called in case if ports were updated while work() method.