diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-04-29 09:50:57 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-04-29 09:50:57 +0200 |
commit | 07d6074b5deadc7ff6d30d5fb47fb6fa863a14ff (patch) | |
tree | 955fb6216739c3d55aeba47a3ea5d8ffc6a7f3e1 /src/linda.h | |
parent | 4a2705af8a9a6b55cf848d53f8330447138a19c4 (diff) | |
download | lanes-07d6074b5deadc7ff6d30d5fb47fb6fa863a14ff.tar.gz lanes-07d6074b5deadc7ff6d30d5fb47fb6fa863a14ff.tar.bz2 lanes-07d6074b5deadc7ff6d30d5fb47fb6fa863a14ff.zip |
All headers reformatted with updated clang-format settings
Diffstat (limited to 'src/linda.h')
-rw-r--r-- | src/linda.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/linda.h b/src/linda.h index 21b6ecc..dbf48b3 100644 --- a/src/linda.h +++ b/src/linda.h | |||
@@ -20,10 +20,10 @@ static constexpr UniqueKey kLindaBatched{ 0xB8234DF772646567ull, "linda.batched" | |||
20 | 20 | ||
21 | using LindaGroup = Unique<int>; | 21 | using LindaGroup = Unique<int>; |
22 | 22 | ||
23 | class Linda : public DeepPrelude // Deep userdata MUST start with this header | 23 | class Linda |
24 | : public DeepPrelude // Deep userdata MUST start with this header | ||
24 | { | 25 | { |
25 | private: | 26 | private: |
26 | |||
27 | static constexpr size_t kEmbeddedNameLength = 24; | 27 | static constexpr size_t kEmbeddedNameLength = 24; |
28 | using EmbeddedName = std::array<char, kEmbeddedNameLength>; | 28 | using EmbeddedName = std::array<char, kEmbeddedNameLength>; |
29 | struct AllocatedName | 29 | struct AllocatedName |
@@ -35,7 +35,6 @@ class Linda : public DeepPrelude // Deep userdata MUST start with this header | |||
35 | std::variant<AllocatedName, EmbeddedName> m_name; | 35 | std::variant<AllocatedName, EmbeddedName> m_name; |
36 | 36 | ||
37 | public: | 37 | public: |
38 | |||
39 | std::condition_variable m_read_happened; | 38 | std::condition_variable m_read_happened; |
40 | std::condition_variable m_write_happened; | 39 | std::condition_variable m_write_happened; |
41 | Universe* const U{ nullptr }; // the universe this linda belongs to | 40 | Universe* const U{ nullptr }; // the universe this linda belongs to |
@@ -43,7 +42,6 @@ class Linda : public DeepPrelude // Deep userdata MUST start with this header | |||
43 | CancelRequest simulate_cancel{ CancelRequest::None }; | 42 | CancelRequest simulate_cancel{ CancelRequest::None }; |
44 | 43 | ||
45 | public: | 44 | public: |
46 | |||
47 | // a fifo full userdata has one uservalue, the table that holds the actual fifo contents | 45 | // a fifo full userdata has one uservalue, the table that holds the actual fifo contents |
48 | [[nodiscard]] static void* operator new(size_t size_, Universe* U_) noexcept { return U_->internal_allocator.alloc(size_); } | 46 | [[nodiscard]] static void* operator new(size_t size_, Universe* U_) noexcept { return U_->internal_allocator.alloc(size_); } |
49 | // always embedded somewhere else or "in-place constructed" as a full userdata | 47 | // always embedded somewhere else or "in-place constructed" as a full userdata |
@@ -61,14 +59,12 @@ class Linda : public DeepPrelude // Deep userdata MUST start with this header | |||
61 | Linda& operator=(Linda const&) = delete; | 59 | Linda& operator=(Linda const&) = delete; |
62 | Linda& operator=(Linda const&&) = delete; | 60 | Linda& operator=(Linda const&&) = delete; |
63 | 61 | ||
64 | static int ProtectedCall(lua_State* L, lua_CFunction f_); | 62 | [[nodiscard]] static int ProtectedCall(lua_State* L, lua_CFunction f_); |
65 | |||
66 | private : | ||
67 | 63 | ||
64 | private: | ||
68 | void setName(char const* name_, size_t len_); | 65 | void setName(char const* name_, size_t len_); |
69 | 66 | ||
70 | public: | 67 | public: |
71 | |||
72 | [[nodiscard]] char const* getName() const; | 68 | [[nodiscard]] char const* getName() const; |
73 | [[nodiscard]] Keeper* whichKeeper() const { return U->keepers->nb_keepers ? &U->keepers->keeper_array[m_keeper_index] : nullptr; } | 69 | [[nodiscard]] Keeper* whichKeeper() const { return U->keepers->nb_keepers ? &U->keepers->keeper_array[m_keeper_index] : nullptr; } |
74 | [[nodiscard]] Keeper* acquireKeeper() const; | 70 | [[nodiscard]] Keeper* acquireKeeper() const; |