<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2010-07-15)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-07-15 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
PR 1607/cpukit
* score/src/coremutexsurrender.c: Clean up and split out helper
routines.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2510&r2=text&tr2=1.2511&diff_format=h">M</a></td><td width='1%'>1.2511</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/score/src/coremutexsurrender.c.diff?r1=text&tr1=1.22&r2=text&tr2=1.23&diff_format=h">M</a></td><td width='1%'>1.23</td><td width='100%'>cpukit/score/src/coremutexsurrender.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2510 rtems/cpukit/ChangeLog:1.2511
--- rtems/cpukit/ChangeLog:1.2510 Thu Jul 15 03:59:46 2010
+++ rtems/cpukit/ChangeLog Thu Jul 15 10:44:39 2010
</font><font color='#997700'>@@ -1,3 +1,9 @@
</font><font color='#000088'>+2010-07-15 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
+
+ PR 1607/cpukit
+ * score/src/coremutexsurrender.c: Clean up and split out helper
+ routines.
+
</font> 2010-07-16 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libfs/src/imfs/imfs.h: Changed IMFS_jnode_types_t to an enum.
<font color='#006600'>diff -u rtems/cpukit/score/src/coremutexsurrender.c:1.22 rtems/cpukit/score/src/coremutexsurrender.c:1.23
--- rtems/cpukit/score/src/coremutexsurrender.c:1.22 Sun Nov 29 07:51:52 2009
+++ rtems/cpukit/score/src/coremutexsurrender.c Thu Jul 15 10:44:40 2010
</font><font color='#997700'>@@ -27,6 +27,51 @@
</font> #include <rtems/score/thread.h>
#include <rtems/score/threadq.h>
<font color='#000088'>+#ifdef __RTEMS_STRICT_ORDER_MUTEX__
+ static inline void _CORE_mutex_Push_priority(
+ CORE_mutex_Control *mutex,
+ Thread_Control *thread
+ )
+ {
+ _Chain_Prepend_unprotected(
+ &thread->lock_mutex,
+ &mutex->queue.lock_queue
+ );
+ mutex->queue.priority_before = thread->current_priority;
+ }
+
+ static inline CORE_mutex_Status _CORE_mutex_Pop_priority(
+ CORE_mutex_Control *mutex,
+ Thread_Control *holder
+ )
+ {
+ /*
+ * Check whether the holder release the mutex in LIFO order if not return
+ * error code.
+ */
+ if ( _Chain_First( holder->lock_mutex ) != &mutex->queue.lock_queue ) {
+ mutex->nest_count++;
+
+ return CORE_MUTEX_RELEASE_NOT_ORDER;
+ }
+
+ /*
+ * This pops the first node from the list.
+ */
+ _Chain_Get_first_unprotected( &holder->lock_mutex );
+
+ if ( mutex->queue.priority_before != holder->current_priority )
+ _Thread_Change_priority( holder, mutex->queue.priority_before, true );
+
+ return CORE_MUTEX_STATUS_SUCCESSFUL;
+ }
+#else
+ #define _CORE_mutex_Push_priority( mutex, thread ) ((void) 0)
+
+ #define _CORE_mutex_Pop_priority( mutex, thread ) \
+ CORE_MUTEX_STATUS_SUCCESSFUL
+#endif
+
</font> /*
* _CORE_mutex_Surrender
*
<font color='#997700'>@@ -59,10 +104,8 @@
</font> {
Thread_Control *the_thread;
Thread_Control *holder;
<font color='#880000'>-#ifdef __RTEMS_STRICT_ORDER_MUTEX__
- Chain_Node *first_node;
-#endif
- holder = the_mutex->holder;
</font><font color='#000088'>+
+ holder = the_mutex->holder;
</font>
/*
* The following code allows a thread (or ISR) other than the thread
<font color='#997700'>@@ -112,37 +155,27 @@
</font> * blocked thread.
*/
if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
<font color='#880000'>- _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ){
-#ifdef __RTEMS_STRICT_ORDER_MUTEX__
- /*Check whether the holder release the mutex in LIFO order
- if not return error code*/
- if(holder->lock_mutex.first != &the_mutex->queue.lock_queue){
- the_mutex->nest_count++;
- return CORE_MUTEX_RELEASE_NOT_ORDER;
- }
- first_node = _Chain_Get_first_unprotected(&holder->lock_mutex);
-#endif
</font><font color='#000088'>+ _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
+ CORE_mutex_Status pop_status =
+ _CORE_mutex_Pop_priority( the_mutex, holder );
+
+ if ( pop_status != CORE_MUTEX_STATUS_SUCCESSFUL )
+ return pop_status;
+
</font> holder->resource_count--;
<font color='#880000'>- }
- the_mutex->holder = NULL;
- the_mutex->holder_id = 0;
</font>
<font color='#880000'>- /*
- * Whether or not someone is waiting for the mutex, an
- * inherited priority must be lowered if this is the last
- * mutex (i.e. resource) this task has.
- */
- if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
- _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
-#ifdef __RTEMS_STRICT_ORDER_MUTEX__
- if(the_mutex->queue.priority_before != holder->current_priority)
- _Thread_Change_priority(holder,the_mutex->queue.priority_before,true);
-#endif
</font><font color='#000088'>+ /*
+ * Whether or not someone is waiting for the mutex, an
+ * inherited priority must be lowered if this is the last
+ * mutex (i.e. resource) this task has.
+ */
</font> if ( holder->resource_count == 0 &&
holder->real_priority != holder->current_priority ) {
_Thread_Change_priority( holder, holder->real_priority, true );
}
}
<font color='#000088'>+ the_mutex->holder = NULL;
+ the_mutex->holder_id = 0;
</font>
/*
* Now we check if another thread was waiting for this mutex. If so,
<font color='#997700'>@@ -172,17 +205,11 @@
</font> case CORE_MUTEX_DISCIPLINES_PRIORITY:
break;
case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
<font color='#880000'>-#ifdef __RTEMS_STRICT_ORDER_MUTEX__
- _Chain_Prepend_unprotected(&the_thread->lock_mutex,&the_mutex->queue.lock_queue);
- the_mutex->queue.priority_before = the_thread->current_priority;
-#endif
</font><font color='#000088'>+ _CORE_mutex_Push_priority( the_mutex, the_thread );
</font> the_thread->resource_count++;
break;
case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
<font color='#880000'>-#ifdef __RTEMS_STRICT_ORDER_MUTEX__
- _Chain_Prepend_unprotected(&the_thread->lock_mutex,&the_mutex->queue.lock_queue);
- the_mutex->queue.priority_before = the_thread->current_priority;
-#endif
</font><font color='#000088'>+ _CORE_mutex_Push_priority( the_mutex, the_thread );
</font> the_thread->resource_count++;
if (the_mutex->Attributes.priority_ceiling <
the_thread->current_priority){
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>