diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-02 10:18:37 +0200 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-05-02 10:18:37 +0200 |
commit | 84889233bfec4ad11ee1160fe63acbbbba7275e7 (patch) | |
tree | 236643b48bbc1a31f26a70d702a7e3f6b93b723f /src/linda.h | |
parent | 8e64f794f08cb3e4f930df5bb17c3a7061516cca (diff) | |
download | lanes-84889233bfec4ad11ee1160fe63acbbbba7275e7.tar.gz lanes-84889233bfec4ad11ee1160fe63acbbbba7275e7.tar.bz2 lanes-84889233bfec4ad11ee1160fe63acbbbba7275e7.zip |
Progressively applying the coding rules
Diffstat (limited to 'src/linda.h')
-rw-r--r-- | src/linda.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/linda.h b/src/linda.h index 7a21571..56941a1 100644 --- a/src/linda.h +++ b/src/linda.h | |||
@@ -32,23 +32,23 @@ class Linda | |||
32 | char* name{ nullptr }; | 32 | char* name{ nullptr }; |
33 | }; | 33 | }; |
34 | // depending on the name length, it is either embedded inside the Linda, or allocated separately | 34 | // depending on the name length, it is either embedded inside the Linda, or allocated separately |
35 | std::variant<AllocatedName, EmbeddedName> m_name; | 35 | std::variant<AllocatedName, EmbeddedName> nameVariant; |
36 | 36 | ||
37 | public: | 37 | public: |
38 | std::condition_variable m_read_happened; | 38 | std::condition_variable readHappened; |
39 | std::condition_variable m_write_happened; | 39 | std::condition_variable writeHappened; |
40 | Universe* const U{ nullptr }; // the universe this linda belongs to | 40 | Universe* const U{ nullptr }; // the universe this linda belongs to |
41 | int const m_keeper_index{ -1 }; // the keeper associated to this linda | 41 | int const keeperIndex{ -1 }; // the keeper associated to this linda |
42 | CancelRequest simulate_cancel{ CancelRequest::None }; | 42 | CancelRequest cancelRequest{ CancelRequest::None }; |
43 | 43 | ||
44 | public: | 44 | public: |
45 | // 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 |
46 | [[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_->internalAllocator.alloc(size_); } |
47 | // 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 |
48 | // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception | 48 | // can't actually delete the operator because the compiler generates stack unwinding code that could call it in case of exception |
49 | static void operator delete(void* p_, Universe* U_) { U_->internal_allocator.free(p_, sizeof(Linda)); } | 49 | static void operator delete(void* p_, Universe* U_) { U_->internalAllocator.free(p_, sizeof(Linda)); } |
50 | // this one is for us, to make sure memory is freed by the correct allocator | 50 | // this one is for us, to make sure memory is freed by the correct allocator |
51 | static void operator delete(void* p_) { static_cast<Linda*>(p_)->U->internal_allocator.free(p_, sizeof(Linda)); } | 51 | static void operator delete(void* p_) { static_cast<Linda*>(p_)->U->internalAllocator.free(p_, sizeof(Linda)); } |
52 | 52 | ||
53 | ~Linda(); | 53 | ~Linda(); |
54 | Linda(Universe* U_, LindaGroup group_, char const* name_, size_t len_); | 54 | Linda(Universe* U_, LindaGroup group_, char const* name_, size_t len_); |
@@ -66,7 +66,7 @@ class Linda | |||
66 | 66 | ||
67 | public: | 67 | public: |
68 | [[nodiscard]] char const* getName() const; | 68 | [[nodiscard]] char const* getName() const; |
69 | [[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[keeperIndex] : nullptr; } |
70 | [[nodiscard]] Keeper* acquireKeeper() const; | 70 | [[nodiscard]] Keeper* acquireKeeper() const; |
71 | void releaseKeeper(Keeper* keeper_) const; | 71 | void releaseKeeper(Keeper* keeper_) const; |
72 | }; | 72 | }; |