Blender V4.3
depsgraph_writeback_sync.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <mutex>
6
7#include "DEG_depsgraph.hh"
9
10#include "BLI_map.hh"
11
12#include "depsgraph.hh"
13
15
16void add(::Depsgraph &depsgraph, std::function<void()> fn)
17{
18 deg::Depsgraph &deg_graph = reinterpret_cast<deg::Depsgraph &>(depsgraph);
19 if (!deg_graph.is_active) {
20 return;
21 }
22
23 std::lock_guard lock{deg_graph.sync_writeback_callbacks_mutex};
24 deg_graph.sync_writeback_callbacks.append(std::move(fn));
25}
26
27} // namespace blender::deg::sync_writeback
volatile int lock
void append(const T &value)
const Depsgraph * depsgraph
void add(Depsgraph &depsgraph, std::function< void()> fn)
Vector< std::function< void()> > sync_writeback_callbacks
Definition depsgraph.hh:185
std::mutex sync_writeback_callbacks_mutex
Definition depsgraph.hh:187