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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -