c# - ReaderWriterLockSlim.TryEnterUpgradeableReadLock(0) is blocking -
in .net application, i've place declare readerwriterlockslim
:
private readonly readerwriterlockslim m_lock = new readerwriterlockslim(lockrecursionpolicy.supportsrecursion);
at other place, refresh value every 100ms, if 1 time, lock isn't accessible, isn't big deal, want exit , wait next call.
so i've following method's content:
if (m_lock.tryenterupgradeablereadlock(0)){ .. }
in application, i'm having deadlocks(which seems have nothing current issue), paused application check threads , saw i've more 20 threads blocked on if condition.
this weird, because the documentation clear this:
if millisecondstimeout 0 (zero), method checks lock state , returns false if desired state unavailable.
the question simple. whyyyyyyyyyyyyyyyyyyy? tried put breakpoints after tryenterupgradeable
, continue, doesn't work.
Comments
Post a Comment