/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include namespace Aws { namespace Utils { RAIICounter::RAIICounter(std::atomic& iCount, std::condition_variable* cv) : m_count(iCount), m_cv(cv) { assert(m_count != std::numeric_limits::max()); m_count++; } RAIICounter::~RAIICounter() { assert(m_count > 0); m_count--; if(m_cv && m_count == 0) { m_cv->notify_all(); } } } }