aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/coroutine/engine/stack/stack.h
diff options
context:
space:
mode:
authoralexeylaptev <alexeylaptev@yandex-team.ru>2022-02-10 16:50:06 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:06 +0300
commit13dbd0acb78595551b843005d6bd021bdc1a859b (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/coroutine/engine/stack/stack.h
parent3106abc0443cda789ce4968aeee63d3a8fcc7d85 (diff)
downloadydb-13dbd0acb78595551b843005d6bd021bdc1a859b.tar.gz
Restoring authorship annotation for <alexeylaptev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/coroutine/engine/stack/stack.h')
-rw-r--r--library/cpp/coroutine/engine/stack/stack.h154
1 files changed, 77 insertions, 77 deletions
diff --git a/library/cpp/coroutine/engine/stack/stack.h b/library/cpp/coroutine/engine/stack/stack.h
index e6b9a3a05d..7d98ba4c68 100644
--- a/library/cpp/coroutine/engine/stack/stack.h
+++ b/library/cpp/coroutine/engine/stack/stack.h
@@ -1,77 +1,77 @@
-#pragma once
-
-#include <util/generic/array_ref.h>
-#include <util/generic/fwd.h>
-#include <util/generic/noncopyable.h>
-
-#include <cstdint>
-
-
-namespace NCoro::NStack {
-
- class IAllocator;
-
-namespace NDetails {
-
- //! Do not use directly, use TStackHolder instead
- class TStack final : private TMoveOnly {
- public:
- /*! rawMemory: can be used by unaligned allocator to free stack memory after use
- * alignedMemory: pointer to aligned memory on which stack workspace and guard are actually placed
- * alignedSize: size of workspace memory + memory for guard
- * guard: guard to protect this stack
- * name: name of coroutine for which this stack is allocated
- */
- TStack(void* rawMemory, void* alignedMemory, uint64_t alignedSize, const char* name);
- TStack(TStack&& rhs) noexcept;
- TStack& operator=(TStack&& rhs) noexcept;
-
- char* GetRawMemory() const noexcept {
- return RawMemory_;
- }
-
- char* GetAlignedMemory() const noexcept {
- return AlignedMemory_;
- }
-
- //! Stack size (includes memory for guard)
- uint64_t GetSize() const noexcept {
- return Size_;
- }
-
- //! Resets parameters, should be called after stack memory is freed
- void Reset() noexcept;
-
- private:
- char* RawMemory_ = nullptr; // not owned
- char* AlignedMemory_ = nullptr; // not owned
- uint64_t Size_ = 0;
- };
-
-} // namespace NDetails
-
- class TStackHolder final : private TMoveOnly {
- public:
- explicit TStackHolder(IAllocator& allocator, uint32_t size, const char* name) noexcept;
- TStackHolder(TStackHolder&&) = default;
- TStackHolder& operator=(TStackHolder&&) = default;
-
- ~TStackHolder();
-
- char* GetAlignedMemory() const noexcept {
- return Stack_.GetAlignedMemory();
- }
- uint64_t GetSize() const noexcept {
- return Stack_.GetSize();
- }
-
- TArrayRef<char> Get() noexcept;
- bool LowerCanaryOk() const noexcept;
- bool UpperCanaryOk() const noexcept;
-
- private:
- IAllocator& Allocator_;
- NDetails::TStack Stack_;
- };
-
-}
+#pragma once
+
+#include <util/generic/array_ref.h>
+#include <util/generic/fwd.h>
+#include <util/generic/noncopyable.h>
+
+#include <cstdint>
+
+
+namespace NCoro::NStack {
+
+ class IAllocator;
+
+namespace NDetails {
+
+ //! Do not use directly, use TStackHolder instead
+ class TStack final : private TMoveOnly {
+ public:
+ /*! rawMemory: can be used by unaligned allocator to free stack memory after use
+ * alignedMemory: pointer to aligned memory on which stack workspace and guard are actually placed
+ * alignedSize: size of workspace memory + memory for guard
+ * guard: guard to protect this stack
+ * name: name of coroutine for which this stack is allocated
+ */
+ TStack(void* rawMemory, void* alignedMemory, uint64_t alignedSize, const char* name);
+ TStack(TStack&& rhs) noexcept;
+ TStack& operator=(TStack&& rhs) noexcept;
+
+ char* GetRawMemory() const noexcept {
+ return RawMemory_;
+ }
+
+ char* GetAlignedMemory() const noexcept {
+ return AlignedMemory_;
+ }
+
+ //! Stack size (includes memory for guard)
+ uint64_t GetSize() const noexcept {
+ return Size_;
+ }
+
+ //! Resets parameters, should be called after stack memory is freed
+ void Reset() noexcept;
+
+ private:
+ char* RawMemory_ = nullptr; // not owned
+ char* AlignedMemory_ = nullptr; // not owned
+ uint64_t Size_ = 0;
+ };
+
+} // namespace NDetails
+
+ class TStackHolder final : private TMoveOnly {
+ public:
+ explicit TStackHolder(IAllocator& allocator, uint32_t size, const char* name) noexcept;
+ TStackHolder(TStackHolder&&) = default;
+ TStackHolder& operator=(TStackHolder&&) = default;
+
+ ~TStackHolder();
+
+ char* GetAlignedMemory() const noexcept {
+ return Stack_.GetAlignedMemory();
+ }
+ uint64_t GetSize() const noexcept {
+ return Stack_.GetSize();
+ }
+
+ TArrayRef<char> Get() noexcept;
+ bool LowerCanaryOk() const noexcept;
+ bool UpperCanaryOk() const noexcept;
+
+ private:
+ IAllocator& Allocator_;
+ NDetails::TStack Stack_;
+ };
+
+}