The docs say
“You can change the type of a Thread at runtime but only from within the Thread itself.”
I have
Dim t as new MyThreadSubclass
t.Type = ThreadTypes.Preemptive
t.Start
The built app runs 40% faster than debug, so it seems like I’m getting preemptive threads even though I didn’t set the Thread Type “within the thread itself” (whatever that means - in the Run event?).
Are the docs wrong, or just poorly-worded?
Maybe you can only change it once running from within the Run Event.
I also think threads run cooperative all the time when in debugger. I think i remember hearing that somewhere.
1 Like
That kinda makes sense as a thread that’s not running isn’t really a thread, just a potential one.
It certainly started out that it only ran as cooperatively in the debugger, but I also think that was then changed soon after.
I take it to mean that you can change the type of a running thread, but only from the thread itself, i.e. in its Run event. You are changing the type of the thread from outside the thread itself but before it even starts to run which should be OK.
1 Like
This is precisely what is going on.
Poorly-worded then. Docs are using “run time” to mean “while the thread is running”.