MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / shutdown

Method shutdown

src/core/AsyncLogWriter.cpp:167–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167void AsyncLogWriter::shutdown()
168{
169 std::shared_ptr<SyncPoint> sync;
170 {
171 std::lock_guard lock(m_mutex);
172 if (!m_started)
173 return;
174
175 m_accepting = false;
176 m_stopping = true;
177 sync = std::make_shared<SyncPoint>();
178 QueueItem item;
179 item.kind = ItemKind::Stop;
180 item.sync = sync;
181 m_queue.push_back(std::move(item));
182 }
183 m_cv.notify_one();
184
185 {
186 std::unique_lock lock(sync->mutex);
187 sync->cv.wait(lock, [&] { return sync->done; });
188 }
189
190 if (m_worker.joinable())
191 m_worker.join();
192
193 std::lock_guard lock(m_mutex);
194 m_started = false;
195 m_stopping = false;
196 m_queue.clear();
197}
198
199bool AsyncLogWriter::isRunning() const
200{

Calls 2

moveFunction · 0.85
clearMethod · 0.45