mirror of
https://github.com/Fennix-Project/Kernel.git
synced 2025-05-28 15:34:33 +00:00
Added GetLocksCount()
This commit is contained in:
parent
3e76830978
commit
bcf46f8341
@ -6,6 +6,9 @@
|
|||||||
#include "../kernel.h"
|
#include "../kernel.h"
|
||||||
|
|
||||||
bool ForceUnlock = false;
|
bool ForceUnlock = false;
|
||||||
|
Atomic<size_t> LocksCount = 0;
|
||||||
|
|
||||||
|
size_t GetLocksCount() { return LocksCount; }
|
||||||
|
|
||||||
void LockClass::DeadLock(SpinLockData Lock)
|
void LockClass::DeadLock(SpinLockData Lock)
|
||||||
{
|
{
|
||||||
@ -62,6 +65,7 @@ Retry:
|
|||||||
CPUData *CoreData = GetCurrentCPU();
|
CPUData *CoreData = GetCurrentCPU();
|
||||||
if (CoreData != nullptr)
|
if (CoreData != nullptr)
|
||||||
LockData.Core = CoreData->ID;
|
LockData.Core = CoreData->ID;
|
||||||
|
LocksCount++;
|
||||||
__sync;
|
__sync;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -73,6 +77,7 @@ int LockClass::Unlock()
|
|||||||
IsLocked.Store(false, MemoryOrder::Release);
|
IsLocked.Store(false, MemoryOrder::Release);
|
||||||
LockData.Count--;
|
LockData.Count--;
|
||||||
IsLocked = false;
|
IsLocked = false;
|
||||||
|
LocksCount--;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -125,6 +130,7 @@ Retry:
|
|||||||
CPUData *CoreData = GetCurrentCPU();
|
CPUData *CoreData = GetCurrentCPU();
|
||||||
if (CoreData != nullptr)
|
if (CoreData != nullptr)
|
||||||
LockData.Core = CoreData->ID;
|
LockData.Core = CoreData->ID;
|
||||||
|
LocksCount++;
|
||||||
__sync;
|
__sync;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -11,6 +11,13 @@
|
|||||||
/* Enabled ONLY on crash. */
|
/* Enabled ONLY on crash. */
|
||||||
extern bool ForceUnlock;
|
extern bool ForceUnlock;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get how many locks are currently in use.
|
||||||
|
*
|
||||||
|
* @return size_t
|
||||||
|
*/
|
||||||
|
size_t GetLocksCount();
|
||||||
|
|
||||||
/** @brief Please use this macro to create a new lock. */
|
/** @brief Please use this macro to create a new lock. */
|
||||||
class LockClass
|
class LockClass
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user