Module: xenomai-forge
Branch: rtdm-api-waitqueues
Commit: 9612c54c1612218be1133de4bc14962a4c900026
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=9612c54c1612218be1133de4bc14962a4c900026

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Apr 16 12:11:08 2014 +0200

alchemy: introduce RT_ALARM_INFO.active flag

This flag is returned by rt_alarm_inquire() into the RT_ALARM_INFO
structure, reflecting the current state of the queried object. If
non-zero, the alarm is enabled (i.e. started).

---

 config/apirev               |    2 +-
 doc/asciidoc/MIGRATION.adoc |    4 ++++
 include/alchemy/alarm.h     |    4 ++++
 lib/alchemy/alarm.c         |    2 ++
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/config/apirev b/config/apirev
index 00750ed..b8626c4 100644
--- a/config/apirev
+++ b/config/apirev
@@ -1 +1 @@
-3
+4
diff --git a/doc/asciidoc/MIGRATION.adoc b/doc/asciidoc/MIGRATION.adoc
index 6b5b5e2..a013447 100644
--- a/doc/asciidoc/MIGRATION.adoc
+++ b/doc/asciidoc/MIGRATION.adoc
@@ -786,6 +786,10 @@ instead.
    * field +expiration+ has been removed, since the corresponding
      information is too short-lived to be valuable to the caller.
 
+   * field +active+ has been added, to reflect the current state of
+     the alarm object. If non-zero, the alarm is enabled
+     (i.e. started).
+
 .Message pipes
 
 - Writing to a message pipe is allowed from all contexts, including
diff --git a/include/alchemy/alarm.h b/include/alchemy/alarm.h
index fd84150..46e7d19 100644
--- a/include/alchemy/alarm.h
+++ b/include/alchemy/alarm.h
@@ -44,6 +44,10 @@ struct RT_ALARM_INFO {
         * Name of alarm object.
         */
        char name[XNOBJECT_NAME_LEN];
+       /**
+        * Active flag.
+        */
+       int active;
 };
 
 typedef struct RT_ALARM_INFO RT_ALARM_INFO;
diff --git a/lib/alchemy/alarm.c b/lib/alchemy/alarm.c
index 84c34eb..16475d4 100644
--- a/lib/alchemy/alarm.c
+++ b/lib/alchemy/alarm.c
@@ -387,6 +387,8 @@ int rt_alarm_inquire(RT_ALARM *alarm, RT_ALARM_INFO *info)
 
        strcpy(info->name, acb->name);
        info->expiries = acb->expiries;
+       info->active = !(alchemy_poll_mode(&acb->itmspec.it_value) &&
+                        alchemy_poll_mode(&acb->itmspec.it_interval));
 
        put_alchemy_alarm(acb);
 out:


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to