Module: xenomai-rpm
Branch: for-upstream
Commit: 55b0aa9de28891fcfd4b4ab097583bd7619223ab
URL:    
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=55b0aa9de28891fcfd4b4ab097583bd7619223ab

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Mar 10 11:42:36 2010 +0100

native: introduce rt_task_same()

This new service checks whether two task descriptors refer to the same
task.

It is particularly useful in user-space, since rt_task_self() does
return a task descriptor which is different from the original
descriptor used by the application, but still refers to the same task
internally.

---

 include/native/task.h         |    7 +++++++
 ksrc/skins/native/API.CHANGES |    8 ++++++++
 ksrc/skins/native/task.c      |   25 +++++++++++++++++++++++++
 src/skins/native/task.c       |    5 +++++
 4 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/include/native/task.h b/include/native/task.h
index 59a40a4..95187f1 100644
--- a/include/native/task.h
+++ b/include/native/task.h
@@ -200,6 +200,11 @@ int rt_task_remove_hook(int type,
 
 int rt_task_catch(void (*handler)(rt_sigset_t));
 
+static inline int rt_task_same(RT_TASK *task1, RT_TASK *task2)
+{
+       return task1 == task2;
+}
+
 #ifdef __cplusplus
 }
 #endif
@@ -317,6 +322,8 @@ static inline int rt_task_spawn(RT_TASK *task,
     return err;
 }
 
+int rt_task_same(RT_TASK *task1, RT_TASK *task2);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/ksrc/skins/native/API.CHANGES b/ksrc/skins/native/API.CHANGES
index 5f73cbf..b9ee04e 100644
--- a/ksrc/skins/native/API.CHANGES
+++ b/ksrc/skins/native/API.CHANGES
@@ -280,3 +280,11 @@ 
___________________________________________________________________
 
        * New rt_queue_flush() service to discard all unread messages
        from a queue.
+
+___________________________________________________________________
+
+
+2.5.1 -> 2.5.2
+
+       * New rt_task_same() call. Returns true whenever two task
+         descriptors refer to the same task, false otherwise.
diff --git a/ksrc/skins/native/task.c b/ksrc/skins/native/task.c
index 08cde01..6d2472e 100644
--- a/ksrc/skins/native/task.c
+++ b/ksrc/skins/native/task.c
@@ -2426,6 +2426,31 @@ int rt_task_reply(int flowid, RT_TASK_MCB *mcb_s)
  * Rescheduling: always unless the task was already terminated.
  */
 
+/**
+ * @fn int rt_task_same(RT_TASK *task1, RT_TASK *task2)
+ *
+ * @brief Compare two task descriptors.
+ *
+ * This service checks whether two task descriptors refer to the same
+ * task. This service is particularly useful in user-space, since
+ * rt_task_self() does return a task descriptor which is different
+ * from the original descriptor used by the application, but still
+ * refers to the same task internally.
+ *
+ * @param task1 The address of the first task descriptor to compare.
+ * @param task2 The address of the second task descriptor to compare.
+ *
+ * @return non-zero whenever the two task descriptors refer to the
+ * same task, zero otherwise.
+ *
+ * This service can be called from:
+ *
+ * - Kernel-based task.
+ * - User-space task.
+ *
+ * Rescheduling: never.
+ */
+
 /*...@}*/
 
 EXPORT_SYMBOL(rt_task_create);
diff --git a/src/skins/native/task.c b/src/skins/native/task.c
index 2c0c114..d975508 100644
--- a/src/skins/native/task.c
+++ b/src/skins/native/task.c
@@ -392,3 +392,8 @@ int rt_task_reply(int flowid, RT_TASK_MCB *mcb_s)
        return XENOMAI_SKINCALL2(__native_muxid,
                                 __native_task_reply, flowid, mcb_s);
 }
+
+int rt_task_same(RT_TASK *task1, RT_TASK *task2)
+{
+       return task1->opaque == task2->opaque;
+}


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to