G
Guest
I am using monitor.tryenter as follows
Do Until Monitor.TryEnter(lockLastBets, 10)
moni += 1
sendMsg("PMB std" &
Thread.CurrentThread.Name & " failed " & moni & " times", timesOther)
Loop
It appears that (occasionally?) the tryEnter doesn't relinquish control to
the other thread which is holding the lock.
I thought the whole point of TryEnter was to give a chance for the other
lock holder to finish his job and release the lock. After n failures TryEnter
returns to caller returning false. The caller can then decide what to do. I
send an error msg and go round the loop again.
Have I got it wrong?
Do Until Monitor.TryEnter(lockLastBets, 10)
moni += 1
sendMsg("PMB std" &
Thread.CurrentThread.Name & " failed " & moni & " times", timesOther)
Loop
It appears that (occasionally?) the tryEnter doesn't relinquish control to
the other thread which is holding the lock.
I thought the whole point of TryEnter was to give a chance for the other
lock holder to finish his job and release the lock. After n failures TryEnter
returns to caller returning false. The caller can then decide what to do. I
send an error msg and go round the loop again.
Have I got it wrong?