View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0003645 | JEDI VCL | 00 JVCL Components | public | 2006-04-18 16:54 | 2006-04-19 05:35 |
Reporter | Arioch | Assigned To | obones | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | JVCL post-3.1 CVS, Delphi 5 | OS | win 2000 | OS Version | |
Product Version | 3.10 | ||||
Target Version | Fixed in Version | 3.30 | |||
Summary | 0003645: TJvThread.Execute - may lead to inconsistent state | ||||
Description | Assume that TJvThread.Exclusive is set to TRUE. ----- quote from TJvThread.Execute ---- if Assigned(FOnExecute) then begin Inc(FThreadCount); --------------------------------------- What if some Exception would be thrown hereafter ? There are 3 lines that potentially can cause it. 1: BaseThread := TJvBaseThread.Create(Self, FOnExecute, P); 2: FThreads.Add(BaseThread); 3: DoCreate; Then thread is not created/started but FThreadCount is not reverted (decremented). So, any later call to .Execute would just quit because of ---------- if Exclusive and OneThreadIsRunning then Exit; ---------- There is no single thread running, but .OneThreadIsRunning claims it is! | ||||
Steps To Reproduce | drop TJvThread onto form, set .Exclusive to true, set .OnBegin event that would 1) JvThread1.OnBegin := nil; 2) Abort; (* or throw any other Exception to cancel thread launching *) set .OnExecute event that would, say, change form's caption or somehow else display that thread was executed drop TButton that would try to execute the thread. 2nd, 3rd, etc pressing of Button1 should make thread running - but it would not. | ||||
Tags | No tags attached. | ||||
|
To add: OneThreadIsRunning is bad name, it confuses do we mean 'AtLeastOne' or 'ExactlyOne' It is better to be renamed to SomeThreadIsRunning What is the sense there to have an extra FThreadCount when we already do have FThread.Count. Speed can't be the reason, since we heavily use, for example, FThread[i] even for .Exclusive jvthreads. |
|
This has now been changed in SVN |