Blender V5.0
lazy_threading.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10#include "BLI_stack.hh"
11#include "BLI_vector.hh"
12
14
21static thread_local HintReceivers hint_receivers = []() {
22 HintReceivers receivers;
23 /* Make sure there is always at least one vector. */
24 receivers.push_as();
25 return receivers;
26}();
27
29{
30 for (const FunctionRef<void()> &fn : hint_receivers.peek()) {
31 fn();
32 }
33}
34
36{
37 hint_receivers.peek().append(fn);
38}
39
41{
42 hint_receivers.peek().pop_last();
43}
44
49
55
56} // namespace blender::lazy_threading
#define BLI_assert(a)
Definition BLI_assert.h:46
void push_as(ForwardT &&...value)
Definition BLI_stack.hh:222
HintReceiver(FunctionRef< void()> fn)
RawStack< RawVector< FunctionRef< void()>, 0 >, 0 > HintReceivers
static HintReceivers hint_receivers
Stack< T, InlineBufferCapacity, RawAllocator > RawStack
Definition BLI_stack.hh:413
Vector< T, InlineBufferCapacity, RawAllocator > RawVector