首页新闻找找看学习计划

Error 1 No such label 'IL_1CF' within the scope of the goto statement

0
悬赏园豆:5 [已关闭问题] 关闭于 2015-01-26 14:13

代码报错:标签'IL_1CF'不在goto语句的使用范围内~~~希望大神指教

private bool TryEnterWriteLockCore(ReaderWriterLockSlimer.TimeoutTracker timeout)
        {
            if (this.fDisposed)
            {
                throw new ObjectDisposedException(null);
            }
            int managedThreadId = Thread.CurrentThread.ManagedThreadId;
            bool flag = false;
            ReaderWriterCount threadRWCount;
            if (!this.fIsReentrant)
            {
                if (managedThreadId == this.writeLockOwnerId)
                {
                    throw new LockRecursionException("LockRecursionException_RecursiveWriteNotAllowed");
                }
                if (managedThreadId == this.upgradeLockOwnerId)
                {
                    flag = true;
                }
                this.EnterMyLock();
                threadRWCount = this.GetThreadRWCount(true);
                if (threadRWCount != null && threadRWCount.readercount > 0)
                {
                    this.ExitMyLock();
                    throw new LockRecursionException("LockRecursionException_WriteAfterReadNotAllowed");
                }
            }
            else
            {
                this.EnterMyLock();
                threadRWCount = this.GetThreadRWCount(false);
                if (managedThreadId == this.writeLockOwnerId)
                {
                    threadRWCount.writercount++;
                    this.ExitMyLock();
                    return true;
                }
                if (managedThreadId == this.upgradeLockOwnerId)
                {
                    flag = true;
                }
                else
                {
                    if (threadRWCount.readercount > 0)
                    {
                        this.ExitMyLock();
                        throw new LockRecursionException("LockRecursionException_WriteAfterReadNotAllowed");
                    }
                }
            }
            int num = 0;
            while (!this.IsWriterAcquired())
            {
                if (flag)
                {
                    uint numReaders = this.GetNumReaders();
                    if (numReaders == 1u)
                    {
                        this.SetWriterAcquired();
                    }
                    else
                    {
                        if (numReaders != 2u || threadRWCount == null)
                        {
                            goto IL_131;
                        }
                        if (this.IsRwHashEntryChanged(threadRWCount))
                        {
                            threadRWCount = this.GetThreadRWCount(false);
                        }
                        if (threadRWCount.readercount <= 0)
                        {
                            goto IL_131;
                        }
                        this.SetWriterAcquired();
                    }
                IL_1CF:
                    if (this.fIsReentrant)
                    {
                        if (this.IsRwHashEntryChanged(threadRWCount))
                        {
                            threadRWCount = this.GetThreadRWCount(false);
                        }
                        threadRWCount.writercount++;
                    }
                    this.ExitMyLock();
                    this.writeLockOwnerId = managedThreadId;
                    return true;
                }
            IL_131:
                if (num < 20)
                {
                    this.ExitMyLock();
                    if (timeout.IsExpired)
                    {
                        return false;
                    }
                    num++;
                    ReaderWriterLockSlimer.SpinWait(num);
                    this.EnterMyLock();
                }
                else
                {
                    if (flag)
                    {
                        if (this.waitUpgradeEvent == null)
                        {
                            this.LazyCreateEvent(ref this.waitUpgradeEvent, true);
                        }
                        else
                        {
                            if (!this.WaitOnEvent(this.waitUpgradeEvent, ref this.numWriteUpgradeWaiters, timeout))
                            {
                                return false;
                            }
                        }
                    }
                    else
                    {
                        if (this.writeEvent == null)
                        {
                            this.LazyCreateEvent(ref this.writeEvent, true);
                        }
                        else
                        {
                            if (!this.WaitOnEvent(this.writeEvent, ref this.numWriteWaiters, timeout))
                            {
                                return false;
                            }
                        }
                    }
                }
            }
            this.SetWriterAcquired();
            goto IL_1CF;
        }

Freedom0619的主页 Freedom0619 | 初学一级 | 园豆:10
提问于:2014-11-19 09:47
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册