public AsyncEntryBlockUC Enter() { using (SpinLock.Enter()) { if (LockStatus == Status.Opened) { LockStatus = Status.Locked; return(new AsyncEntryBlockUC(ExclusiveEntry)); } AccessItem access; Queue.Enqueue(access = AccessItem.NewTCS()); return(new AsyncEntryBlockUC(null, access.TCS)); } }
public EntryBlockUC Enter() { AccessItem access; using (SpinLock.Enter()) { if (LockStatus == Status.Opened) { LockStatus = Status.Locked; return(ExclusiveEntry); } Queue.Enqueue(access = AccessItem.NewTCS()); } return(access.WaitForResult()); //waiting synchronously for completion }