Commit f5b7f8a4 by Tobias Langer

Added task deadline attribute to task attributes.

This commit adds the deadline attribute to the task attributes struct.
The task deadline is an 64bit value.
parent 73578401
...@@ -710,6 +710,9 @@ enum mtapi_task_attributes_enum { ...@@ -710,6 +710,9 @@ enum mtapi_task_attributes_enum {
MTAPI_TASK_AFFINITY, MTAPI_TASK_AFFINITY,
MTAPI_TASK_USER_DATA, MTAPI_TASK_USER_DATA,
MTAPI_TASK_COMPLETE_FUNCTION MTAPI_TASK_COMPLETE_FUNCTION
#ifdef EMBB_HARD_REALTIME
,MTAPI_TASK_DEADLINE
#endif /*EMBB_HARD_REALTIME*/
}; };
/** size of the \a MTAPI_TASK_DETACHED attribute */ /** size of the \a MTAPI_TASK_DETACHED attribute */
#define MTAPI_TASK_DETACHED_SIZE sizeof(mtapi_boolean_t) #define MTAPI_TASK_DETACHED_SIZE sizeof(mtapi_boolean_t)
...@@ -719,6 +722,10 @@ enum mtapi_task_attributes_enum { ...@@ -719,6 +722,10 @@ enum mtapi_task_attributes_enum {
#define MTAPI_TASK_PRIORITY_SIZE sizeof(mtapi_uint_t) #define MTAPI_TASK_PRIORITY_SIZE sizeof(mtapi_uint_t)
/** size of the \a MTAPI_TASK_AFFINITY attribute */ /** size of the \a MTAPI_TASK_AFFINITY attribute */
#define MTAPI_TASK_AFFINITY_SIZE sizeof(mtapi_affinity_t) #define MTAPI_TASK_AFFINITY_SIZE sizeof(mtapi_affinity_t)
#ifdef EMBB_HARD_REALTIME
/** size of the \a MTAPI_TASK_DEADLINE attribute */
#define MTAPI_TASK_DEADLINE_SIZE sizeof(mtapi_uint64_t)
#endif /*EMBB_HARD_REALTIME*/
/** /**
...@@ -810,6 +817,9 @@ struct mtapi_task_attributes_struct { ...@@ -810,6 +817,9 @@ struct mtapi_task_attributes_struct {
mtapi_boolean_t is_detached; /**< stores MTAPI_TASK_DETACHED */ mtapi_boolean_t is_detached; /**< stores MTAPI_TASK_DETACHED */
mtapi_uint_t num_instances; /**< stores MTAPI_TASK_INSTANCES */ mtapi_uint_t num_instances; /**< stores MTAPI_TASK_INSTANCES */
mtapi_uint_t priority; /**< stores MTAPI_TASK_PRIORITY */ mtapi_uint_t priority; /**< stores MTAPI_TASK_PRIORITY */
#ifdef EMBB_HARD_REALTIME
mtapi_uint64_t deadline; /**< stores MTAPI_TASK_DEADLINE */
#endif /*EMBB_HARD_REALTIME*/
mtapi_affinity_t affinity; /**< stores MTAPI_TASK_AFFINITY */ mtapi_affinity_t affinity; /**< stores MTAPI_TASK_AFFINITY */
void * user_data; /**< stores MTAPI_TASK_USER_DATA */ void * user_data; /**< stores MTAPI_TASK_USER_DATA */
mtapi_task_complete_function_t mtapi_task_complete_function_t
......
...@@ -60,5 +60,8 @@ mtapi_status_t embb_mtapi_attr_get_##TYPE(const TYPE* source, \ ...@@ -60,5 +60,8 @@ mtapi_status_t embb_mtapi_attr_get_##TYPE(const TYPE* source, \
} }
embb_mtapi_attr_implementation(mtapi_uint_t); embb_mtapi_attr_implementation(mtapi_uint_t);
#ifdef EMBB_HARD_REALTIME
embb_mtapi_attr_implementation(mtapi_uint64_t);
#endif /*EMBB_HARD_REALTIME*/
embb_mtapi_attr_implementation(mtapi_affinity_t); embb_mtapi_attr_implementation(mtapi_affinity_t);
embb_mtapi_attr_implementation(mtapi_boolean_t); embb_mtapi_attr_implementation(mtapi_boolean_t);
...@@ -41,6 +41,9 @@ mtapi_status_t embb_mtapi_attr_get_##TYPE(const TYPE* source, \ ...@@ -41,6 +41,9 @@ mtapi_status_t embb_mtapi_attr_get_##TYPE(const TYPE* source, \
void* attribute, mtapi_size_t attribute_size); void* attribute, mtapi_size_t attribute_size);
embb_mtapi_attr(mtapi_uint_t) embb_mtapi_attr(mtapi_uint_t)
#ifdef EMBB_HARD_REALTIME
embb_mtapi_attr(mtapi_uint64_t);
#endif /*EMBB_HARD_REALTIME*/
embb_mtapi_attr(mtapi_affinity_t) embb_mtapi_attr(mtapi_affinity_t)
embb_mtapi_attr(mtapi_boolean_t) embb_mtapi_attr(mtapi_boolean_t)
......
...@@ -439,6 +439,13 @@ void mtapi_task_get_attribute( ...@@ -439,6 +439,13 @@ void mtapi_task_get_attribute(
&local_task->attributes.priority, attribute, attribute_size); &local_task->attributes.priority, attribute, attribute_size);
break; break;
#ifdef EMBB_HARD_REALTIME
case MTAPI_TASK_DEADLINE:
local_status = embb_mtapi_attr_get_mtapi_uint64_t(
&local_task->attributes.deadline, attribute, attribute_size);
break;
#endif /*EMBB_HARD_REALTIME*/
default: default:
local_status = MTAPI_ERR_ATTR_NUM; local_status = MTAPI_ERR_ATTR_NUM;
break; break;
......
...@@ -102,6 +102,13 @@ void mtapi_taskattr_set( ...@@ -102,6 +102,13 @@ void mtapi_taskattr_set(
local_status = MTAPI_SUCCESS; local_status = MTAPI_SUCCESS;
break; break;
#ifdef EMBB_HARD_REALTIME
case MTAPI_TASK_DEADLINE:
local_status = embb_mtapi_attr_set_mtapi_uint64_t(
&attributes->deadline, attribute, attribute_size);
break;
#endif /*EMBB_HARD_REALTIME*/
default: default:
/* attribute unknown */ /* attribute unknown */
local_status = MTAPI_ERR_ATTR_NUM; local_status = MTAPI_ERR_ATTR_NUM;
......
...@@ -130,6 +130,26 @@ class TaskAttributes { ...@@ -130,6 +130,26 @@ class TaskAttributes {
return *this; return *this;
} }
#ifdef EMBB_HARD_REALTIME
/**
* Sets the deadline of a Task.
* The deadline influences the order in which tasks are chosen for execution
* if real-time scheduling is used as the scheduling method.
*
* \returns Reference to this object.
* \notthreadsafe
*/
TaskAttributes & SetDeadline(
mtapi_uint64_t deadline /**< The deadline to set. */
) {
mtapi_status_t status;
mtapi_taskattr_set(&attributes_, MTAPI_TASK_DEADLINE,
&deadline, sizeof(deadline), &status);
internal::CheckStatus(status);
return *this;
}
#endif /*EMBB_HARD_REALTIME*/
/** /**
* Returns the internal representation of this object. * Returns the internal representation of this object.
* Allows for interoperability with the C interface. * Allows for interoperability with the C interface.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment