Page 1 of 1

Please don't error on if thread does not exist

Posted: Thu Jun 30, 2011 10:10 pm
by Mistrel
PauseThread, ResumeThread, KillThread, etc. Considering threads are running independently, I've have some programs crash because of this:

Code: Select all

If ActiveThread
  OldThread=ActiveThread
  PauseThread(OldThread)
EndIf
Where the thread exists before it enters the "if" but does not while inside.

You can signal threads, yes. But what is the point of PauseThread if it's unsafe to be used?

Re: Please don't error on if thread does not exist

Posted: Thu Jun 30, 2011 10:23 pm
by tinman
Shouldn't this be in the feature requests forum?

Anyway, I'd agree except for ResumeThread. If you call ResumeThread() on a thread that doesn't exist because it was already running and has exited then you're doing something wrong.