Confirmation
Similarly, the test code from my first post, but without
'Sleep 1, 1' triggers after a while:
Code: Select all
Dim As Any Ptr ptid
Sub myThread (Byval p As Any Ptr)
Dim As Any Ptr ptid = *Cast(Any Ptr Ptr, p)
If ptid = 0 Then
Print Time; " the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made"
End If
End Sub
Do
ptid = 0
ptid = Threadcreate(@myThread, @ptid)
Threadwait(ptid)
Loop Until Inkey <> ""
13:03:11 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
13:04:10 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
13:04:32 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
13:06:16 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
13:07:01 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
13:07:05 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
13:07:21 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
13:09:05 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
I will add a sentence in the documentation.
[edit]
With the
'Sleep 1, 1' line, the fault occurrence obviously has a much longer period:
Code: Select all
Dim As Any Ptr ptid
Sub myThread (Byval p As Any Ptr)
Dim As Any Ptr ptid = *Cast(Any Ptr Ptr, p)
If ptid = 0 Then
Print Time; " the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made"
End If
End Sub
Print Time
Do
ptid = 0
ptid = Threadcreate(@myThread, @ptid)
Threadwait(ptid)
Sleep 1, 1
Loop Until Inkey <> ""
13:10:58
13:24:37 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
13:54:34 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
14:17:14 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
14:26:57 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
15:15:45 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
16:34:20 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made
17:12:40 the assignment 'ptid = Threadcreate(@myThread, @ptid)' is not yet made