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"
|
||||
|
||||
bool ForceUnlock = false;
|
||||
Atomic<size_t> LocksCount = 0;
|
||||
|
||||
size_t GetLocksCount() { return LocksCount; }
|
||||
|
||||
void LockClass::DeadLock(SpinLockData Lock)
|
||||
{
|
||||
@ -62,6 +65,7 @@ Retry:
|
||||
CPUData *CoreData = GetCurrentCPU();
|
||||
if (CoreData != nullptr)
|
||||
LockData.Core = CoreData->ID;
|
||||
LocksCount++;
|
||||
__sync;
|
||||
|
||||
return 0;
|
||||
@ -73,6 +77,7 @@ int LockClass::Unlock()
|
||||
IsLocked.Store(false, MemoryOrder::Release);
|
||||
LockData.Count--;
|
||||
IsLocked = false;
|
||||
LocksCount--;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -125,6 +130,7 @@ Retry:
|
||||
CPUData *CoreData = GetCurrentCPU();
|
||||
if (CoreData != nullptr)
|
||||
LockData.Core = CoreData->ID;
|
||||
LocksCount++;
|
||||
__sync;
|
||||
|
||||
return 0;
|
||||
|
@ -11,6 +11,13 @@
|
||||
/* Enabled ONLY on crash. */
|
||||
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. */
|
||||
class LockClass
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user