Entropic 2.14.3
Local-first agentic inference engine
Loading...
Searching...
No Matches
tool_root_lock.h
Go to the documentation of this file.
1// SPDX-License-Identifier: Apache-2.0
41#pragma once
42
44
45#include <atomic>
46#include <shared_mutex>
47#include <string>
48#include <thread>
49
50namespace entropic {
51
64class ENTROPIC_EXPORT ToolRootLock {
65public:
70 void lock();
71
76 void unlock();
77
91 bool lock_shared(const std::string& what);
92
97 void unlock_shared();
98
104 bool owned_by_this_thread() const;
105
106private:
107 std::shared_mutex mutex_;
108 std::atomic<std::thread::id> owner_{};
109 int depth_ = 0;
110};
111
119class ENTROPIC_EXPORT ToolRootShared {
120public:
127 ToolRootShared(ToolRootLock& lock, const std::string& what);
128
134
135 ToolRootShared(const ToolRootShared&) = delete;
136 ToolRootShared& operator=(const ToolRootShared&) = delete;
137
138private:
139 ToolRootLock& lock_;
140 bool held_;
141};
142
143} // namespace entropic
Shared/exclusive lock whose exclusive side is re-entrant for its owner, and whose owner passes throug...
RAII shared hold on a ToolRootLock (owner pass-through aware).
Symbol visibility macro for all exported symbols.
Activate model on GPU (WARM → ACTIVE).