]> git.hungrycats.org Git - bees/commitdiff
c++20: Implicit value sharing of `this` is deprecated in C++20
authorZygo Blaxell <bees@furryterror.org>
Mon, 21 Jul 2025 13:48:40 +0000 (09:48 -0400)
committerZygo Blaxell <bees@furryterror.org>
Tue, 22 Jul 2025 01:21:54 +0000 (21:21 -0400)
Fix the handful of instances.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
(cherry picked from commit 4d6b21fb40174c3ecdc9e97670dae0dd22ce74a6)

lib/task.cc
src/bees-context.cc
src/bees-thread.cc

index fb90dcce28453284a37c2f076d32328b3c928d29..25072854ff03e6f644aae7d0313298e1b105d8d8 100644 (file)
@@ -754,7 +754,7 @@ namespace crucible {
                m_prev_loadavg = getloadavg1();
 
                if (target && !m_load_tracking_thread) {
-                       m_load_tracking_thread = make_shared<thread>([=] () { loadavg_thread_fn(); });
+                       m_load_tracking_thread = make_shared<thread>([this] () { loadavg_thread_fn(); });
                        m_load_tracking_thread->detach();
                }
        }
@@ -944,7 +944,7 @@ namespace crucible {
        TaskConsumer::TaskConsumer(const shared_ptr<TaskMasterState> &tms) :
                m_master(tms)
        {
-               m_thread = make_shared<thread>([=](){ consumer_thread(); });
+               m_thread = make_shared<thread>([this](){ consumer_thread(); });
        }
 
        class BarrierState {
index 0ffa3dad6ab85026be11d76c44e1596a3bd46225..e6da4fc4d2fd762a8ea1179ae47a33b6248f767e 100644 (file)
@@ -1126,15 +1126,15 @@ BeesContext::start()
        m_progress_thread = make_shared<BeesThread>("progress_report");
        m_progress_thread = make_shared<BeesThread>("progress_report");
        m_status_thread = make_shared<BeesThread>("status_report");
-       m_progress_thread->exec([=]() {
+       m_progress_thread->exec([this]() {
                show_progress();
        });
-       m_status_thread->exec([=]() {
+       m_status_thread->exec([this]() {
                dump_status();
        });
 
        // Set up temporary file pool
-       m_tmpfile_pool.generator([=]() -> shared_ptr<BeesTempFile> {
+       m_tmpfile_pool.generator([this]() -> shared_ptr<BeesTempFile> {
                return make_shared<BeesTempFile>(shared_from_this());
        });
        m_logical_ino_pool.generator([]() {
index 4445c46dc9c0b26f8237fc0efa38f4a2b361bebc..62e80d8185255c9193381c71ffdfe9546ac02fd4 100644 (file)
@@ -14,7 +14,7 @@ BeesThread::exec(function<void()> func)
 {
        m_timer.reset();
        BEESLOGDEBUG("BeesThread exec " << m_name);
-       m_thread_ptr = make_shared<thread>([=]() {
+       m_thread_ptr = make_shared<thread>([this, func]() {
                BeesNote::set_name(m_name);
                BEESLOGDEBUG("Starting thread " << m_name);
                BEESNOTE("thread function");