diff --git a/include/onnxruntime/core/platform/EigenNonBlockingThreadPool.h b/include/onnxruntime/core/platform/EigenNonBlockingThreadPool.h index a45ceebba171b..c7aa8d94873dd 100644 --- a/include/onnxruntime/core/platform/EigenNonBlockingThreadPool.h +++ b/include/onnxruntime/core/platform/EigenNonBlockingThreadPool.h @@ -1470,10 +1470,7 @@ class ThreadPoolTempl : public onnxruntime::concurrency::ExtendedThreadPoolInter void SetBlocked(std::function should_block, std::function post_block) { std::unique_lock lk(mutex); - auto old_status = status.exchange(ThreadStatus::Blocking, std::memory_order_seq_cst); - if(old_status != ThreadStatus::Spinning){ - abort(); - } + ORT_ENFORCE(status.exchange(ThreadStatus::Blocking, std::memory_order_seq_cst) == ThreadStatus::Spinning); if (should_block()) { status.store(ThreadStatus::Blocked, std::memory_order_relaxed); do {