mirror of
https://github.com/Zygo/bees.git
synced 2025-06-16 17:46:16 +02:00
Task: convert print_fn to a string
Since we are now unconditionally rendering the print_fn as a static string, there is no need for it to be a function. We also need it to be brief and mostly constant. Use a string instead. Put the string before the function in the Task constructor arguments so that the title string appears as a heading in code, since we are making a breaking API change already. Drop TASK_MACRO as it is broken by this change, but there is no similar usage of Task anywhere to make it worth fixing. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
namespace crucible {
|
||||
using namespace std;
|
||||
@ -22,7 +23,7 @@ namespace crucible {
|
||||
public:
|
||||
|
||||
// create Task object containing closure and description
|
||||
Task(function<void()> exec_fn, function<ostream&(ostream &)> print_fn);
|
||||
Task(string title, function<void()> exec_fn);
|
||||
|
||||
// schedule Task at end of queue.
|
||||
// May run Task in current thread or in other thread.
|
||||
@ -33,7 +34,7 @@ namespace crucible {
|
||||
void run_earlier() const;
|
||||
|
||||
// describe Task as text
|
||||
ostream &print(ostream &os) const;
|
||||
string title() const;
|
||||
|
||||
// Returns currently executing task if called from exec_fn.
|
||||
// Usually used to reschedule the currently executing Task.
|
||||
|
Reference in New Issue
Block a user