Skip to content

Commit f70bf0e

Browse files
committed
CpuBoundWork#~CpuBoundWork(): just call #Done() to deduplicate code
1 parent d34c754 commit f70bf0e

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

lib/base/io-engine.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,6 @@ CpuBoundWork::CpuBoundWork(boost::asio::yield_context yc)
3434
}
3535
}
3636

37-
CpuBoundWork::~CpuBoundWork()
38-
{
39-
if (!m_Done) {
40-
IoEngine::Get().m_CpuBoundSemaphore.fetch_add(1);
41-
}
42-
}
43-
4437
void CpuBoundWork::Done()
4538
{
4639
if (!m_Done) {

lib/base/io-engine.hpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ class CpuBoundWork
3535
CpuBoundWork(CpuBoundWork&&) = delete;
3636
CpuBoundWork& operator=(const CpuBoundWork&) = delete;
3737
CpuBoundWork& operator=(CpuBoundWork&&) = delete;
38-
~CpuBoundWork();
38+
39+
inline ~CpuBoundWork()
40+
{
41+
Done();
42+
}
3943

4044
void Done();
4145

0 commit comments

Comments
 (0)