optional parameter (flags) for CreateThread()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Deeem2031
Enthusiast
Enthusiast
Posts: 216
Joined: Sat Sep 20, 2003 3:57 pm
Location: Germany
Contact:

optional parameter (flags) for CreateThread()

Post 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)
irc://irc.freenode.org/#purebasic
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Re: optional parameter (flags) for CreateThread()

Post by PB »

I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
User avatar
Michael Vogel
Addict
Addict
Posts: 2797
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Post 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)...
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post 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.
Post Reply