Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
RTL
Delphi
Arithmetic
ConvUtils
Date - Time
DateUtils
File Management
Format + Float
Input/Output
Math Unit
Memory, Pointer, Address
Null-terminated strings
Other Classes
Other RTL
Pascal Strings
Regular Expressions
RTL Exceptions
Text Files
Thread support
Typed/Untyped Files
WinAPI
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/RTL/Delphi/Thread support
[ Add a report in this area ]
Report #:
100163
Status:
Closed
TThread.Start dont work for me
Project:
Delphi
Build #:
16.0.4276.44006
Version:
16.1
Submitted By:
Dmitry Aleshin
Report Type:
Basic functionality failure
Date Reported:
10/17/2011 1:41:27 PM
Severity:
Infrequently encountered problem
Last Updated:
10/19/2011 1:17:40 AM
Platform:
All versions
Internal Tracking #:
Resolution:
Test Case Error
(Resolution Comments)
Resolved in Build:
:
None
Duplicate of:
None
Voting and Rating
Overall Rating:
No Ratings Yet
0.00 out of 5
Total Votes:
None
Description
I've noticed that resume method is deprecated. But start method is not works for me
Steps to Reproduce:
Create a descendant fo TThread. Override contructor.
constructor TThreadDescendant.Create();
begin
inherited Create(True);
Start;
end;
this code raise an exception for me.
Workarounds
None
Attachment
Project1.zip
Comments
Tomohiro Takahashi at 10/18/2011 5:28:44 AM
-
Could you please attach sample project to reproduce/verify your issue?
Dmitry Aleshin at 10/18/2011 8:02:35 PM
-
I've attached it
Tomohiro Takahashi at 10/19/2011 1:32:49 AM
-
>[Steps]
> ...
> this code raise an exception for me.
Do you get EThread excetion, right?
You will be able to find the reason of the error in System.Classes.pas.
----------
TThread = class
private type
...
// Use Start after creating a suspended thread.
procedure Start;
...
...
procedure TThread.InternalStart(Force: Boolean);
begin
...
if ResumeThread(FHandle) <> 1 then
raise EThread.Create(SThreadStartError);
...
----------
> // Use Start after creating a suspended thread.
Generally speaking, inside constructor, we should not call a method(in this case, Start method), which is commonly called by outside.
So, correct code is below. Please call Start method after finishing construction of TThread completely.
-----------
...
TThreadDescendant = class(TThread)
protected
procedure Execute; override;
public
constructor Create;
end;
...
constructor TThreadDescendant.Create();
begin
inherited Create(True);
//Start;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
t: TThreadDescendant;
begin
t := TThreadDescendant.Create;
t.Start;
end;
procedure TThreadDescendant.Execute;
begin
end;
-----------
Dmitry Aleshin at 10/23/2011 8:16:19 PM
-
I dont have sources in starter. So i cannot understand the reason of exception.
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us