Page 1 of 1

optional parameter (flags) for CreateThread()

Posted: Sun Apr 16, 2006 2:11 am
by Deeem2031
In result of this thread (german forum) http://www.purebasic.fr/german/viewtopi ... 02&start=0 a optional parameter for CreateThread() to define the creationflags of the kernel32-proc createthread_() would be nice. Like the example in the german forum:

Code: Select all

thread = CreateThread(@a(),0,#CREATE_SUSPENDED) ;wait until ResumeThread 
Delay(500) 
ResumeThread(thread) ;start thread
Delay(500)

Re: optional parameter (flags) for CreateThread()

Posted: Sun Apr 16, 2006 2:19 am
by PB

Posted: Sun Apr 16, 2006 7:44 am
by Michael Vogel
Just a wish for the syntax check of the compiler: please test, if the "()" are forgotten after the called procedure!

A CreateThread(@something,parameter) is accepted and can lead do unpredictable effects (and it could take a while to find the error)...

Posted: Mon Apr 17, 2006 6:56 pm
by Trond
Because @procedure returns the address of the variable procedure, and is a perfectly legal expression. Type EnableExplicit at the top of the source to get an error message.