All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-core] [PATCH] trivial native mutex doc tweak.
@ 2007-12-02 13:03 Paul
  2007-12-03 10:23 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Paul @ 2007-12-02 13:03 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]


Attached, trivial patch for native rt_mutex_acquire function documentation. 
The reference to deprecated (and undocumented) rt_mutex_lock() & 
rt_mutex_release() is a little confusing.

 Also updated the code snippets to match.


Regards, Paul.



[-- Attachment #2: native-mutex-doc.diff --]
[-- Type: text/x-diff, Size: 2104 bytes --]

Index: ksrc/skins/native/mutex.c
===================================================================
--- ksrc/skins/native/mutex.c	(revision 3229)
+++ ksrc/skins/native/mutex.c	(working copy)
@@ -297,7 +297,7 @@ int rt_mutex_delete(RT_MUTEX *mutex)
  * recursive and implement the priority inheritance protocol.
  *
  * Since a nested locking count is maintained for the current owner,
- * rt_mutex_lock() and rt_mutex_unlock() must be used in pairs.
+ * rt_mutex_acquire() and rt_mutex_release() must be used in pairs.
  *
  * Tasks pend on mutexes by priority order.
  *
Index: ksrc/skins/native/snippets/mutex.c
===================================================================
--- ksrc/skins/native/snippets/mutex.c	(revision 3229)
+++ ksrc/skins/native/snippets/mutex.c	(working copy)
@@ -17,11 +17,11 @@ int main (int argc, char *argv[])
     /* Now, grab the mutex lock, run the critical section, then
        release the lock: */
 
-    rt_mutex_lock(&mutex_desc,TM_INFINITE);
+    rt_mutex_acquire(&mutex_desc,TM_INFINITE);
 
     /* ... Critical section ... */
     
-    rt_mutex_unlock(&mutex_desc);
+    rt_mutex_release(&mutex_desc);
 
     /* ... */
 }
Index: ksrc/skins/native/snippets/cond_var.c
===================================================================
--- ksrc/skins/native/snippets/cond_var.c	(revision 3229)
+++ ksrc/skins/native/snippets/cond_var.c	(working copy)
@@ -21,12 +21,12 @@ void foo (void)
 
     /* Now, wait for some task to post the shared event... */
 
-    rt_mutex_lock(&mutex_desc,TM_INFINITE);
+    rt_mutex_acquire(&mutex_desc,TM_INFINITE);
 
     while (!shared_event && !err)
 	err = rt_cond_wait(&cond_desc,&mutex_desc,TM_INFINITE);
     
-    rt_mutex_unlock(&mutex_desc);
+    rt_mutex_release(&mutex_desc);
 
     /* ... */
 }
@@ -38,12 +38,12 @@ void bar (void)
 
     /* Post the shared event. */
 
-    rt_mutex_lock(&mutex_desc,TM_INFINITE);
+    rt_mutex_acquire(&mutex_desc,TM_INFINITE);
 
     shared_event = 1;
     rt_cond_signal(&cond_desc);
 
-    rt_mutex_unlock(&mutex_desc);
+    rt_mutex_release(&mutex_desc);
 
     /* ... */
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-03 10:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-02 13:03 [Xenomai-core] [PATCH] trivial native mutex doc tweak Paul
2007-12-03 10:23 ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.