BUT if you think it is just me then I will never mention it again,Not a problem for me I am just trying to help out. Even though you too have mentioned having to use wait to make a plugin function work properly.
My problem is not that you mention it, but that I can't understand why do you have these problems. No, I use wait() only in some macros where a delay must be after an output change. In plugins I use Thread.Sleep() not to load the CPU useless when it is just in a while loop waiting for an other thread to finish. The plugin would work fine without it, but there's no reason to load the CPU. Example from a new plugin:
- Code: Select all
Private Function ReferenceProbe() As Boolean
Dim thrStartProbe As New Thread(Sub() ReferenceProbeThreadFrame())
thrStartProbe.CurrentCulture = Thread.CurrentThread.CurrentCulture
ReferenceProbeResult = False
thrStartProbe.Start()
While thrStartProbe.IsAlive
Thread.Sleep(50) ' <--- This sleep is just for not to load the CPU while the thread is working
End While
Return ReferenceProbeResult
End Function
Edit: I'll check your code maybe in the evening.