mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-08-29 18:39:15 +08:00
score: Fix _Debug_Is_owner_of_allocator()
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user