change log for rtems (2010-07-15)
rtems-vc at rtems.org
rtems-vc at rtems.org
Thu Jul 15 16:10:26 UTC 2010
*joel*:
2010-07-15 Sebastian Huber <Sebastian.Huber at embedded-brains.de>
PR 1607/cpukit
* score/src/coremutexsurrender.c: Clean up and split out helper
routines.
M 1.2511 cpukit/ChangeLog
M 1.23 cpukit/score/src/coremutexsurrender.c
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
@@ -1,3 +1,9 @@
+2010-07-15 Sebastian Huber <Sebastian.Huber at embedded-brains.de>
+
+ PR 1607/cpukit
+ * score/src/coremutexsurrender.c: Clean up and split out helper
+ routines.
+
2010-07-16 Sebastian Huber <sebastian.huber at embedded-brains.de>
* libfs/src/imfs/imfs.h: Changed IMFS_jnode_types_t to an enum.
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
@@ -27,6 +27,51 @@
#include <rtems/score/thread.h>
#include <rtems/score/threadq.h>
+#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
+
/*
* _CORE_mutex_Surrender
*
@@ -59,10 +104,8 @@
{
Thread_Control *the_thread;
Thread_Control *holder;
-#ifdef __RTEMS_STRICT_ORDER_MUTEX__
- Chain_Node *first_node;
-#endif
- holder = the_mutex->holder;
+
+ holder = the_mutex->holder;
/*
* The following code allows a thread (or ISR) other than the thread
@@ -112,37 +155,27 @@
* blocked thread.
*/
if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
- _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
+ _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;
+
holder->resource_count--;
- }
- the_mutex->holder = NULL;
- the_mutex->holder_id = 0;
- /*
- * 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
+ /*
+ * 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 ( holder->resource_count == 0 &&
holder->real_priority != holder->current_priority ) {
_Thread_Change_priority( holder, holder->real_priority, true );
}
}
+ the_mutex->holder = NULL;
+ the_mutex->holder_id = 0;
/*
* Now we check if another thread was waiting for this mutex. If so,
@@ -172,17 +205,11 @@
case CORE_MUTEX_DISCIPLINES_PRIORITY:
break;
case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
-#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
+ _CORE_mutex_Push_priority( the_mutex, the_thread );
the_thread->resource_count++;
break;
case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
-#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
+ _CORE_mutex_Push_priority( the_mutex, the_thread );
the_thread->resource_count++;
if (the_mutex->Attributes.priority_ceiling <
the_thread->current_priority){
--
Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20100715/2724ecd9/attachment-0001.html>
More information about the vc
mailing list