run_scope.cpp¶
src/types/run_scope.cpp
@file run_scope.cpp @brief gh#158: per-thread publication of the running turn's cancel token.
Owners: @tvanfossen
RunCancelScope
entropic::RunCancelScope::RunCancelScope(std::atomic< bool > *token)
Publish token as this thread's run cancel token.
src/types/run_scope.cpp:57
Source · 4 lines
RunCancelScope::RunCancelScope(std::atomic<bool>* token)
: previous_(t_run_cancel) {
t_run_cancel = token;
}Activity · 1 steps
Requirements
RunSessionScope
entropic::RunSessionScope::RunSessionScope(std::string key)
Publish key as this thread's run session key.
src/types/run_scope.cpp:104
Source · 4 lines
RunSessionScope::RunSessionScope(std::string key)
: previous_(t_run_session) {
t_run_session = std::move(key);
}Activity · 1 steps
Requirements
RunStreamScope
entropic::RunStreamScope::RunStreamScope(RunStreamFn fn, void *user_data)
Publish (fn, user_data) as this thread's stream sink.
src/types/run_scope.cpp:150
Source · 5 lines
RunStreamScope::RunStreamScope(RunStreamFn fn, void* user_data)
: previous_fn_(t_run_stream_fn), previous_ud_(t_run_stream_ud) {
t_run_stream_fn = fn;
t_run_stream_ud = user_data;
}Activity · 2 steps
Requirements
cancel_current_run
bool entropic::cancel_current_run()
Cancel the run executing on this thread (gh#158).
src/types/run_scope.cpp:68
Source · 7 lines
bool cancel_current_run() {
if (t_run_cancel == nullptr) {
return false;
}
t_run_cancel->store(true, std::memory_order_release);
return true;
}Activity · 4 steps
Requirements
current_run_cancel
const std::atomic< bool > * entropic::current_run_cancel()
The cancel token of the run executing on this thread, if any.
src/types/run_scope.cpp:37
Source · 1 line
const std::atomic<bool>* current_run_cancel() { return t_run_cancel; }Activity · 1 steps
Requirements
current_run_cancelled
bool entropic::current_run_cancelled()
Whether THIS thread's run has been cancelled.
src/types/run_scope.cpp:45
Called by generation_cancelled, poll_stop, request_cancelled, run_interrupted
Calls none
Source · 4 lines
bool current_run_cancelled() {
return t_run_cancel != nullptr
&& t_run_cancel->load(std::memory_order_acquire);
}Activity · 1 steps
Requirements
current_run_session
std::string entropic::current_run_session()
The session key of the run executing on this thread (gh#166).
src/types/run_scope.cpp:95
Called by check_read_before_write, execute, facade_get_tool_prompt, outside_root_thunk, read_and_track
Calls none
Source · 1 line
std::string current_run_session() { return t_run_session; }Activity · 1 steps
Requirements
emit_to_current_run_stream
bool entropic::emit_to_current_run_stream(const char *chunk, size_t len)
Deliver a chunk to the stream sink published on THIS thread.
src/types/run_scope.cpp:137
Source · 5 lines
bool emit_to_current_run_stream(const char* chunk, size_t len) {
const bool installed = t_run_stream_fn != nullptr;
if (installed) { t_run_stream_fn(chunk, len, t_run_stream_ud); }
return installed;
}Activity · 4 steps
Requirements
~RunCancelScope
entropic::RunCancelScope::~RunCancelScope()
Restore the previously installed token.
src/types/run_scope.cpp:82
The index is older than this file: the lines it records no longer hold this function. Refresh the index to bundle its body.
Requirements
~RunSessionScope
entropic::RunSessionScope::~RunSessionScope()
Restore the previously published key.
src/types/run_scope.cpp:115
The index is older than this file: the lines it records no longer hold this function. Refresh the index to bundle its body.
Requirements
~RunStreamScope
entropic::RunStreamScope::~RunStreamScope()
Restore the previously published sink.
src/types/run_scope.cpp:161
The index is older than this file: the lines it records no longer hold this function. Refresh the index to bundle its body.