ginsonic
asked on
Thread problem
When I try to set:
Priority := tpNormal ;
get next error message:
"Thread error: The handle is invalid (6)"
constructor TGNThread.Create( AnimateMe : TgnClass );
begin
Animated := AnimateMe;
Priority := tpNormal ; // here is my problem. If delete it all work fine !?!?!?
OnTerminate := Animated.Fine;
FreeOnTerminate := True;
inherited Create ( False );
end;
Priority := tpNormal ;
get next error message:
"Thread error: The handle is invalid (6)"
constructor TGNThread.Create( AnimateMe : TgnClass );
begin
Animated := AnimateMe;
Priority := tpNormal ; // here is my problem. If delete it all work fine !?!?!?
OnTerminate := Animated.Fine;
FreeOnTerminate := True;
inherited Create ( False );
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sorry , I wish to say:
inherited Create ( true);
Animated := AnimateMe;
Priority := tpNormal ;
OnTerminate := Animated.Fine;
FreeOnTerminate := True;
Copy problem :)
inherited Create ( true);
Animated := AnimateMe;
Priority := tpNormal ;
OnTerminate := Animated.Fine;
FreeOnTerminate := True;
Copy problem :)
with your contructor without
suspended := false
thread will not run (execute). you will successfully create it, but it will in suspended state
inherited Create(true)
will create it in suspended,
.Execute method will never called
so you need
suspended := false or calling Resume
to resume thread
suspended := false
thread will not run (execute). you will successfully create it, but it will in suspended state
inherited Create(true)
will create it in suspended,
.Execute method will never called
so you need
suspended := false or calling Resume
to resume thread
ASKER
Look like resume solve all problems. Suspended make my VCL to not work for all my actions.
ASKER
Thanks again for support!
:)) That's why i've used resume in my example :)
F68 ;-)
F68 ;-)
ASKER
Don't need to suspend or resume my thread. Just:
Animated := AnimateMe;
Priority := tpNormal ;
OnTerminate := Animated.Fine;
FreeOnTerminate := True;
suspended := false;
What was interesting is that an old compiled exe what use inherited after ( wrongh way ) run perfect !?!? The new compiled return the error!?!?!?
Thanks for help!