Please don't error on if thread does not exist

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Mistrel
Addict
Addict
Posts: 3415
Joined: Sat Jun 30, 2007 8:04 pm

Please don't error on if thread does not exist

Post 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?
User avatar
tinman
PureBasic Expert
PureBasic Expert
Posts: 1102
Joined: Sat Apr 26, 2003 4:56 pm
Location: Level 5 of Robot Hell
Contact:

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

Post 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.
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)
Post Reply