https://learn.microsoft.com/es-es/dotnet/api/system.threading.lock.isheldbycurrentthread?view=net-10.0
Lock.IsHeldByCurrentThread Propiedad (System.Threading) | Microsoft Learn
Obtiene un valor que indica si el subproceso actual mantiene el bloqueo.
lockpropiedadsystemthreadingmicrosoft