diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-12 09:26:11 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-11-12 09:26:11 +0000 |
commit | 434fca0b458910329f63da49b9b1c84de232bf3f (patch) | |
tree | 6060535c3c2b13e40b37867b21230fdbdc7c80ec /vespalib | |
parent | de23b574462e6931e6afd0906257f0bd7673f1f8 (diff) |
Name the threads so it is easier to see who is doing what.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/runnable.h | 14 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h | 11 |
2 files changed, 13 insertions, 12 deletions
diff --git a/vespalib/src/vespa/vespalib/util/runnable.h b/vespalib/src/vespa/vespalib/util/runnable.h index 3b387a2067c..9d6481fbb19 100644 --- a/vespalib/src/vespa/vespalib/util/runnable.h +++ b/vespalib/src/vespa/vespalib/util/runnable.h @@ -3,14 +3,26 @@ #pragma once #include <memory> +#include <functional> namespace vespalib { +// Convenience macro used to create a function that can be used as an +// init function when creating an executor to inject a frame with the +// given name into the stack of all worker threads. + +#define VESPA_THREAD_STACK_TAG(name) \ + int name(::vespalib::Runnable &worker) { \ + worker.run(); \ + return 1; \ + } + /** * Interface implemented in order to be run by a Thread. **/ struct Runnable { - typedef std::unique_ptr<Runnable> UP; + using UP = std::unique_ptr<Runnable>; + using init_fun_t = std::function<int(Runnable&)>; /** * Entry point called by the running thread diff --git a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h index e5cc87c1937..c86597ca153 100644 --- a/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h +++ b/vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h @@ -16,16 +16,6 @@ namespace vespalib { namespace thread { struct ThreadInit; } -// Convenience macro used to create a function that can be used as an -// init function when creating an executor to inject a frame with the -// given name into the stack of all worker threads. - -#define VESPA_THREAD_STACK_TAG(name) \ - int name(::vespalib::Runnable &worker) { \ - worker.run(); \ - return 1; \ - } - /** * An executor service that executes tasks in multiple threads. **/ @@ -33,7 +23,6 @@ class ThreadStackExecutorBase : public SyncableThreadExecutor, public Runnable { public: - using init_fun_t = std::function<int(Runnable&)>; using unique_lock = std::unique_lock<std::mutex>; private: |