diff --git a/tasks_cpp/include/embb/tasks/node.h b/tasks_cpp/include/embb/tasks/node.h index 666cab1..3561a32 100644 --- a/tasks_cpp/include/embb/tasks/node.h +++ b/tasks_cpp/include/embb/tasks/node.h @@ -130,6 +130,15 @@ class Node { } /** + * Returns the number of available tasks. + * \return The number of available tasks + * \waitfree + */ + mtapi_uint_t GetTaskLimit() const { + return task_limit_; + } + + /** * Returns the number of available cores. * \return The number of available cores * \waitfree @@ -229,6 +238,7 @@ class Node { mtapi_task_context_t * context); mtapi_uint_t queue_count_; + mtapi_uint_t task_limit_; mtapi_uint_t core_count_; mtapi_uint_t worker_thread_count_; mtapi_action_hndl_t action_handle_; diff --git a/tasks_cpp/src/node.cc b/tasks_cpp/src/node.cc index 8dc49b0..031338a 100644 --- a/tasks_cpp/src/node.cc +++ b/tasks_cpp/src/node.cc @@ -78,6 +78,9 @@ Node::Node( mtapi_node_get_attribute(node_id, MTAPI_NODE_MAX_QUEUES, &queue_count_, sizeof(queue_count_), &status); assert(MTAPI_SUCCESS == status); + mtapi_node_get_attribute(node_id, MTAPI_NODE_MAX_TASKS, &task_limit_, + sizeof(queue_count_), &status); + assert(MTAPI_SUCCESS == status); core_count_ = info.hardware_concurrency; worker_thread_count_ = embb_core_set_count(&attr->core_affinity); action_handle_ = mtapi_action_create(TASKS_CPP_JOB, action_func,