[PATCH 8/8] doc: rtems_task_set_scheduler()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Apr 16 14:15:50 UTC 2014


---
 cpukit/rtems/include/rtems/rtems/tasks.h |    3 +
 doc/user/smp.t                           |   76 ++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 0 deletions(-)

diff --git a/cpukit/rtems/include/rtems/rtems/tasks.h b/cpukit/rtems/include/rtems/rtems/tasks.h
index 72eb553..a9016ce 100644
--- a/cpukit/rtems/include/rtems/rtems/tasks.h
+++ b/cpukit/rtems/include/rtems/rtems/tasks.h
@@ -560,6 +560,9 @@ rtems_status_code rtems_task_get_scheduler(
 /**
  * @brief Sets the scheduler of a task.
  *
+ * The scheduler of a task is initialized to the scheduler of the task that
+ * created it.
+ *
  * @param[in] id Identifier of the task.  Use @ref RTEMS_SELF to select the
  * executing task.
  * @param[in] scheduler_id Identifier of the scheduler.
diff --git a/doc/user/smp.t b/doc/user/smp.t
index 9703c14..f998539 100644
--- a/doc/user/smp.t
+++ b/doc/user/smp.t
@@ -405,6 +405,82 @@ Returns the scheduler identifier of a task in @code{scheduler_id}.
 None.
 
 @c
+ at c rtems_task_set_scheduler
+ at c
+ at page
+ at subsection TASK_SET_SCHEDULER - Set scheduler of a task
+
+ at subheading CALLING SEQUENCE:
+
+ at ifset is-C
+ at example
+rtems_status_code rtems_task_set_scheduler(
+  rtems_id id,
+  rtems_id scheduler_id
+);
+ at end example
+ at end ifset
+
+ at ifset is-Ada
+ at end ifset
+
+ at subheading DIRECTIVE STATUS CODES:
+
+ at code{@value{RPREFIX}SUCCESSFUL} - successful operation@*
+ at code{@value{RPREFIX}INVALID_ID} - invalid task or scheduler id@*
+ at code{@value{RPREFIX}INCORRECT_STATE} - the task is in the wrong state to
+perform a scheduler change
+
+ at subheading DESCRIPTION:
+
+Sets the scheduler of a task specified by @code{scheduler_id}.  The scheduler
+of a task is initialized to the scheduler of the task that created it.
+
+ at subheading NOTES:
+
+None.
+
+ at subheading EXAMPLE:
+
+ at example
+ at group
+#include <rtems.h>
+#include <assert.h>
+
+void task(rtems_task_argument arg);
+
+void example(void)
+@{
+  rtems_status_code sc;
+  rtems_id          task_id;
+  rtems_id          scheduler_id;
+  rtems_name        scheduler_name;
+
+  scheduler_name = rtems_build_name('W', 'O', 'R', 'K');
+
+  sc = rtems_scheduler_ident(scheduler_name, &scheduler_id);
+  assert(sc == RTEMS_SUCCESSFUL);
+
+  sc = rtems_task_create(
+    rtems_build_name('T', 'A', 'S', 'K'),
+    1,
+    RTEMS_MINIMUM_STACK_SIZE,
+    RTEMS_DEFAULT_MODES,
+    RTEMS_DEFAULT_ATTRIBUTES,
+    &task_id
+  );
+  assert(sc == RTEMS_SUCCESSFUL);
+
+  sc = rtems_task_set_scheduler(task_id, scheduler_id);
+  assert(sc == RTEMS_SUCCESSFUL);
+
+  sc = rtems_task_start(task_id, task, 0);
+  assert(sc == RTEMS_SUCCESSFUL);
+@}
+ at end group
+ at end example
+
+ at c
 @c rtems_task_get_affinity
 @c
 @page
-- 
1.7.7




More information about the devel mailing list