Module: xenomai-forge
Branch: master
Commit: c22dad851fedaa8dfc20ff63765b062c815e003a
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=c22dad851fedaa8dfc20ff63765b062c815e003a

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Dec  2 18:50:54 2011 +0100

cobalt/monitor: account for interrupt while relocking

---

 lib/cobalt/internal.c |   48 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 36 insertions(+), 12 deletions(-)

diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index a1d13d0..161197a 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -180,11 +180,17 @@ void cobalt_monitor_grant(cobalt_monitor_t *mon, unsigned 
long *u_mode)
 
 int cobalt_monitor_grant_sync(cobalt_monitor_t *mon, unsigned long *u_mode)
 {
+       int ret;
+
        cobalt_monitor_grant(mon, u_mode);
 
-       return XENOMAI_SKINCALL1(__cobalt_muxid,
-                                sc_cobalt_monitor_sync,
-                                mon);
+       ret = XENOMAI_SKINCALL1(__cobalt_muxid,
+                               sc_cobalt_monitor_sync,
+                               mon);
+       if (ret)
+               return cobalt_monitor_enter(mon);
+
+       return 0;
 }
 
 void cobalt_monitor_grant_all(cobalt_monitor_t *mon, unsigned long *u_mode)
@@ -196,11 +202,17 @@ void cobalt_monitor_grant_all(cobalt_monitor_t *mon, 
unsigned long *u_mode)
 
 int cobalt_monitor_grant_all_sync(cobalt_monitor_t *mon, unsigned long *u_mode)
 {
+       int ret;
+
        cobalt_monitor_grant_all(mon, u_mode);
 
-       return XENOMAI_SKINCALL1(__cobalt_muxid,
-                                sc_cobalt_monitor_sync,
-                                mon);
+       ret = XENOMAI_SKINCALL1(__cobalt_muxid,
+                               sc_cobalt_monitor_sync,
+                               mon);
+       if (ret)
+               return cobalt_monitor_enter(mon);
+
+       return 0;
 }
 
 void cobalt_monitor_drain(cobalt_monitor_t *mon)
@@ -212,11 +224,17 @@ void cobalt_monitor_drain(cobalt_monitor_t *mon)
 
 int cobalt_monitor_drain_sync(cobalt_monitor_t *mon)
 {
+       int ret;
+
        cobalt_monitor_drain(mon);
 
-       return XENOMAI_SKINCALL1(__cobalt_muxid,
-                                sc_cobalt_monitor_sync,
-                                mon);
+       ret = XENOMAI_SKINCALL1(__cobalt_muxid,
+                               sc_cobalt_monitor_sync,
+                               mon);
+       if (ret)
+               return cobalt_monitor_enter(mon);
+
+       return 0;
 }
 
 void cobalt_monitor_drain_all(cobalt_monitor_t *mon)
@@ -228,9 +246,15 @@ void cobalt_monitor_drain_all(cobalt_monitor_t *mon)
 
 int cobalt_monitor_drain_all_sync(cobalt_monitor_t *mon)
 {
+       int ret;
+
        cobalt_monitor_drain_all(mon);
 
-       return XENOMAI_SKINCALL1(__cobalt_muxid,
-                                sc_cobalt_monitor_sync,
-                                mon);
+       ret = XENOMAI_SKINCALL1(__cobalt_muxid,
+                               sc_cobalt_monitor_sync,
+                               mon);
+       if (ret)
+               return cobalt_monitor_enter(mon);
+
+       return 0;
 }


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

Reply via email to