ExitGames.Threading.WriteLock

Options
ymlyjq
edited July 2013 in Photon Server
[code2=csharp]public bool AddItem(Item item)
{
using (WriteLock.TryEnter(this.readerWriterLock, this.maxLockMilliseconds))
{
if (this.items.ContainsKey(item.Id))
{
return false;
}

this.items.Add(item.Id, item);
return true;
}
}[/code2]

when use WriteLock.TryEnter() happend exception , it can unlock ?

we known lock is like
[code2=csharp]try
{
monitor.enter(obj);
]
finally
{
monitor.exit(obj);
}[/code2]