Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
feat(task): add an interface to query thread info (#464)
Browse files Browse the repository at this point in the history
  • Loading branch information
Smityz authored May 21, 2020
1 parent a769521 commit cd53ad6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/dsn/tool-api/task.h
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ class aio_task : public task
};
typedef dsn::ref_ptr<aio_task> aio_task_ptr;

const std::vector<task_worker *> &get_threadpool_threads_info(threadpool_code code);

// ------------------------ inline implementations --------------------
__inline /*static*/ void task::check_tls_dsn()
{
Expand Down
5 changes: 5 additions & 0 deletions src/core/core/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,11 @@ void task::enqueue(task_worker_pool *pool)
pool->enqueue(this);
}

const std::vector<task_worker *> &get_threadpool_threads_info(threadpool_code code)
{
return dsn::task::get_current_node2()->computation()->get_pool(code)->workers();
}

timer_task::timer_task(
task_code code, const task_handler &cb, int interval_milliseconds, int hash, service_node *node)
: task(code, hash, node), _interval_milliseconds(interval_milliseconds), _cb(cb)
Expand Down

0 comments on commit cd53ad6

Please sign in to comment.