vb.net mutex类抛出异常错误

时间:2013-12-06 08:09:00

标签: vb.net

我发现错误代码“由于放弃互斥而等待完成。任何人都可以告诉我如何解决它?

以下是代码:

Try
     gcLog.log(" UseResource Start[1]")
     ltWaitTimeSpan = New System.TimeSpan(0, 0, 20)
     gcLog.log(" UseResource Start[3]")

    If mut.WaitOne(ltWaitTimeSpan, True) Then
        Thread_Status = True
        Thread_Status_Chk_Count = 0
        gcLog.log(Thread.CurrentThread.Name + " Thread Start !!![2]")
        lsWorkInstID = Thread.CurrentThread.Name
        gcCommon.IsWorkSheetIDExist(Thread.CurrentThread.Name)
        gcMsgQue.mnDisMsgInfo2Label_Active(lsWorkInstID)
        gcLog.log(" UseResource Start[2]")
        Dim loSeqManage As clsSeqManage
        loSeqManage = New clsSeqManage

        If Not loSeqManage.bReadMsgFmDb(lsWorkInstID, lsLotID) Then
            'gcLog.log(" UseResource Start[3]")
            Thread_Status = False
        Else
            Dim loOutput2Prt As New clsOutput(lsLotID,gtMsgQueueEvent.sCryFileName)
            loOutput2Prt.SetVariable()
            'gcLog.log(" UseResource Start[4]")

            If (loOutput2Prt.Output2PrtAuto And Not loOutput2Prt.GetMoreBatchFlag)
        Then  
                gcLog.log(Thread.CurrentThread.Name + " Delete Record !!!")
                Call loOutput2Prt.bDeleteMsgFmBuf()
            End If
            gcLog.log(Thread.CurrentThread.Name + " Thread Release !!![22]")
            Thread_Status = False
            mut.ReleaseMutex()
        End If
    End If

Catch ex As Exception
    gcLog.log("UseResource : " + ex.Message & vbLf & ex.TargetSite.Name)
    Call gfncCallError("2", "PrintFormServer", "UseResource : " + ex.Message & ""& ex.TargetSite.Name)
    Thread_Status = False
End Try

0 个答案:

没有答案