summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-19 08:55:01 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-19 08:55:01 +0100
commitfaf3ff8f5ecdf9aa00c7bd28474c7fde55db9d33 (patch)
tree6f2c46a64bd43930ac6fccd7a560c6efbd6ab67f
parentlibmisc/capture: Clean up formatting on ARM. (diff)
downloadrtems-faf3ff8f5ecdf9aa00c7bd28474c7fde55db9d33.tar.bz2
score: Fix _Debug_Is_owner_of_allocator()
-rw-r--r--cpukit/score/src/debugisownerofallocator.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/cpukit/score/src/debugisownerofallocator.c b/cpukit/score/src/debugisownerofallocator.c
index 42b773033c..7879902025 100644
--- a/cpukit/score/src/debugisownerofallocator.c
+++ b/cpukit/score/src/debugisownerofallocator.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 embedded brains GmbH. All rights reserved.
+ * Copyright (c) 2014-2015 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
@@ -19,6 +19,7 @@
#include <rtems/score/assert.h>
#include <rtems/score/apimutex.h>
#include <rtems/score/thread.h>
+#include <rtems/score/threaddispatch.h>
#if defined( RTEMS_DEBUG )
bool _Debug_Is_owner_of_allocator( void )
@@ -26,12 +27,20 @@
API_Mutex_Control *mutex = _RTEMS_Allocator_Mutex;
bool owner;
+ /*
+ * We have to synchronize with the _CORE_mutex_Surrender() operation,
+ * otherwise we may observe an outdated mutex holder.
+ */
+ _Thread_Disable_dispatch();
+
if ( mutex != NULL ) {
- owner = mutex->Mutex.holder == _Thread_Get_executing();
+ owner = mutex->Mutex.holder == _Thread_Executing;
} else {
owner = false;
}
+ _Thread_Enable_dispatch();
+
return owner;
}
#endif