How i can give to CreateThread my sub without error? It id my first try in FreeBasic.
Help me please.
Code: Select all
TYPE TThread
terminated AS INTEGER
handle AS ANY PTR
delay AS INTEGER
DECLARE CONSTRUCTOR()
DECLARE DESTRUCTOR()
DECLARE SUB mainloop(param as Any PTR)
END TYPE
CONSTRUCTOR TThread()
this.handle = THREADCREATE(@mainloop,0)
END CONSTRUCTOR
DESTRUCTOR TThread()
this.terminated = true
END DESTRUCTOR
sub TThread.mainloop(param as Any PTR)
do
if terminated = true then exit do
sleep delay, 1
loop
end sub