aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-11-12 09:26:11 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-11-12 09:26:11 +0000
commit434fca0b458910329f63da49b9b1c84de232bf3f (patch)
tree6060535c3c2b13e40b37867b21230fdbdc7c80ec /vespalib
parentde23b574462e6931e6afd0906257f0bd7673f1f8 (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.h14
-rw-r--r--vespalib/src/vespa/vespalib/util/threadstackexecutorbase.h11
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: