mirror of
https://github.com/Zygo/bees.git
synced 2025-06-16 17:46:16 +02:00
task: allow external access to Task print function
This enables bees' thread introspection to use task descriptions in status and log messages. BeesNote will be calling Task::current_task() from non-Task contexts, which means we need to allow Task's shared state pointer to be null. Remove some asserts that will ruin our day in that case. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
@ -32,13 +32,22 @@ namespace crucible {
|
||||
// schedule Task before other queued tasks
|
||||
void run_earlier() const;
|
||||
|
||||
// describe Task as text
|
||||
ostream &print(ostream &os) const;
|
||||
|
||||
// Returns currently executing task if called from exec_fn.
|
||||
// Usually used to reschedule the currently executing Task.
|
||||
static Task current_task();
|
||||
|
||||
// Ordering for containers
|
||||
bool operator<(const Task &that) const;
|
||||
|
||||
// Null test
|
||||
operator bool() const;
|
||||
};
|
||||
|
||||
ostream &operator<<(ostream &os, const Task &task);
|
||||
|
||||
class TaskMaster {
|
||||
public:
|
||||
// Blocks until the running thread count reaches this number
|
||||
|
Reference in New Issue
Block a user