Blender V5.3
session_uid.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
9#include "BLI_session_uid.hh"
10
11#include "atomic_ops.h"
12
13namespace blender {
14
15/* Denotes last used UID.
16 * It might eventually overflow, and easiest is to add more bits to it. */
17static SessionUID global_session_uid = detail::SESSION_UID_NONE;
18
20{
23 if (!result.is_generated()) {
24 /* Happens when the UID overflows.
25 *
26 * Just request the UID once again, hoping that there are not a lot of high-priority threads
27 * which will overflow the counter once again between the previous call and this one.
28 *
29 * NOTE: It is possible to have collisions after such overflow. */
31 }
32 return result;
33}
34
35} // namespace blender
Provides wrapper around system-specific atomic primitives, and some extensions (faked-atomic operatio...
ATOMIC_INLINE uint64_t atomic_add_and_fetch_uint64(uint64_t *p, uint64_t x)
BMesh Iterators.
SessionUID BLI_session_uid_generate()
static uint global_session_uid
Definition lib_id.cc:1573