xLeaves
11-07-2019, 06:59
Write a simple script like the one below:
MsgBox(0, "test1")
MsgBox(0, "test2")
MsgBox(0, "test3")
MsgBox(0, "test4")
MsgBox(0, "test5")
MsgBox(0, "test6")
MsgBox(0, "test7")
MsgBox(0, "test8")
MsgBox(0, "test9")
MsgBox(0, "test0")
After running, about one-twentieth of the probability of abnormal exit.
There is another way to reproduce this problem more easily.
Copy the code below to run:
USES "OS"
Function TBMain() As Long
Dim argc As Long = OS_GetCommands()
If (argc > 1) And (LCase$(OS_GetCommand(2)) = "-work") Then
Dim sWorkName As String = OS_GetCommand(3)
If sWorkName <> "" Then
If Function_Exists("Work_" & sWorkName) Then
Dim iRetVal As Long
Dim sWorkParam As String = Trim$(OS_GetCommand(4), """")
Call_IfExists "Work_" & sWorkName(sWorkParam) To iRetVal
Return iRetVal
Else
MsgBox 0, "您创建了任务,但任务执行流程 (Work_" & sWorkName & ") 不存在!", %MB_ICONWARNING, "灵智机器人"
Return -1
End If
Else
MsgBox 0, "缺少任务流程参数!", %MB_ICONWARNING, "灵智机器人"
Return -1
End If
Else
// 转入入口点
Dim iRet As Long
Call_IfExists "Main" To iRet
Return iRet
End If
End Function
// Create Work
Function Work_Create(ByVal sWorkName As String, ByVal sParam As String) As Long
Dim sExecute As String = OS_ProcessGetFullPath(OS_GetCurrentProcessId())
Dim sCmd as String
If Not(APP_IsBundled) Then
sExecute &= " " & OS_GetCommand(1)
End If
Dim iRet As Long = OS_Shell(sExecute & " -work " & sWorkName & " """ & sParam & """")
Return iRet
End Function
// Main Process
Function Main() As Long
Msgbox "Main Process start"
Dim Work1 As Long = Work_Create("Proc1", "param")
Work_Create("Proc2", "param 222222")
Msgbox "Main Process stop"
End Function
// Work1 Process
Function Work_Proc1(ByVal sParam As String) As Long
msgbox "Work1 Process Create : " & sParam
End Function
// Work2 Process
Function Work_Proc2(ByVal sParam As String) As Long
msgbox "Work2 Process Create : " & sParam
End Function
Will find that MsgBox pop-ups will always be less.
The probability of error is about 1/5.
MsgBox(0, "test1")
MsgBox(0, "test2")
MsgBox(0, "test3")
MsgBox(0, "test4")
MsgBox(0, "test5")
MsgBox(0, "test6")
MsgBox(0, "test7")
MsgBox(0, "test8")
MsgBox(0, "test9")
MsgBox(0, "test0")
After running, about one-twentieth of the probability of abnormal exit.
There is another way to reproduce this problem more easily.
Copy the code below to run:
USES "OS"
Function TBMain() As Long
Dim argc As Long = OS_GetCommands()
If (argc > 1) And (LCase$(OS_GetCommand(2)) = "-work") Then
Dim sWorkName As String = OS_GetCommand(3)
If sWorkName <> "" Then
If Function_Exists("Work_" & sWorkName) Then
Dim iRetVal As Long
Dim sWorkParam As String = Trim$(OS_GetCommand(4), """")
Call_IfExists "Work_" & sWorkName(sWorkParam) To iRetVal
Return iRetVal
Else
MsgBox 0, "您创建了任务,但任务执行流程 (Work_" & sWorkName & ") 不存在!", %MB_ICONWARNING, "灵智机器人"
Return -1
End If
Else
MsgBox 0, "缺少任务流程参数!", %MB_ICONWARNING, "灵智机器人"
Return -1
End If
Else
// 转入入口点
Dim iRet As Long
Call_IfExists "Main" To iRet
Return iRet
End If
End Function
// Create Work
Function Work_Create(ByVal sWorkName As String, ByVal sParam As String) As Long
Dim sExecute As String = OS_ProcessGetFullPath(OS_GetCurrentProcessId())
Dim sCmd as String
If Not(APP_IsBundled) Then
sExecute &= " " & OS_GetCommand(1)
End If
Dim iRet As Long = OS_Shell(sExecute & " -work " & sWorkName & " """ & sParam & """")
Return iRet
End Function
// Main Process
Function Main() As Long
Msgbox "Main Process start"
Dim Work1 As Long = Work_Create("Proc1", "param")
Work_Create("Proc2", "param 222222")
Msgbox "Main Process stop"
End Function
// Work1 Process
Function Work_Proc1(ByVal sParam As String) As Long
msgbox "Work1 Process Create : " & sParam
End Function
// Work2 Process
Function Work_Proc2(ByVal sParam As String) As Long
msgbox "Work2 Process Create : " & sParam
End Function
Will find that MsgBox pop-ups will always be less.
The probability of error is about 1/5.