38 # include <dsn/tool-api/task_queue.h> 39 # include <dsn/utility/extensible_object.h> 40 # include <dsn/utility/synchronize.h> 41 # include <dsn/utility/dlib.h> 42 # include <dsn/tool-api/perf_counter.h> 59 return new T(pool, q, index, inner_provider);
66 DSN_API
virtual ~task_worker(
void);
72 DSN_API
virtual void loop();
75 const std::string& name()
const {
return _name; }
76 int index()
const {
return _index; }
77 int native_tid()
const {
return _native_tid; }
78 task_worker_pool* pool()
const {
return _owner_pool; }
79 task_queue* queue()
const {
return _input_queue; }
80 DSN_API
const threadpool_spec& pool_spec()
const;
81 DSN_API
static task_worker* current();
84 task_worker_pool* _owner_pool;
85 task_queue* _input_queue;
91 utils::notify_event _started;
92 int _processed_task_count;
95 DSN_API
static void set_name(
const char* name);
96 DSN_API
static void set_priority(worker_priority_t pri);
97 DSN_API
static void set_affinity(uint64_t affinity);
107 DSN_API
static join_point<void, task_worker*> on_start;
108 DSN_API
static join_point<void, task_worker*> on_create;
task queue batches the input queue for the bound task worker(s) (threads)
Definition: task_queue.h:55
task worker processes the input tasks from the bound task queue
Definition: task_worker.h:54