VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 1234[5]678910 ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 10:38:29 07/23/02 Tue
Author: Michel
Subject: Re: TImageScrollBox.Destroy hangs when destroying TReadAheadThread
In reply to: glup 's message, "TImageScrollBox.Destroy hangs when destroying TReadAheadThread" on 07:23:00 07/23/02 Tue


Hi Glup,

Here is a repost about the problem with the thread not terminating. If the read ahead thread is suspended when it is not used, so it should not consume resources.

Best regards,

Michel


Hi All,

For those using Delphi 6 (and also recommended for other versions) here is a quick fix to fix the TImageScrollBox destructor which prevented a program from
terminating.

In EnImgScr.Pas,

replace the TReadAheadThread.Execute method with,

procedure TReadAheadThread.Execute;
begin
Priority := tpLowest;

repeat
Suspend;

if not Terminated then
begin
try
FRequestIsValid := False;

if not FileExists( FReadAheadFileName ) then
continue;

FGraphic.Free;

FGraphic := NewDibGraphic( FReadAheadFileName );
if FGraphic <> nil then
FGraphic.LoadFromFile(FReadAheadFileName);

if (FGraphic = nil) or FGraphic.IsEmpty then
continue;

FRequestIsValid := True;

except
FRequestIsValid := False;
end;
end;

until Terminated;
end;

Add at the beginning of TImageScrollBox.Destroy, (before FReadAheadThread.Free)

FReadAheadThread.Terminate;
FReadAheadThread.Resume;
FReadAheadThread.WaitFor;

Best regards,

Michel

>I create in a Fax application where I use Version 2 of
>the libary for each Fax to open a new instance of a
>form, but the application hangs, if I close one of
>them.
>
>I found that this is because of freeing
>TReadAheadThread and there waiting for the thread to
>terminate.
>
>What to do?
>
>I use Win2000.
>
>
>Just an anotation:
>Why do you use for each TImageScrollBox a new
>TReadAheadThread? This is waste of resources. A pool
>of workerthreads where you could specifey the number
>of threads would be much more appropirate...
>... and then linking the transforms with the same
>threadpool for async processing would be the
>ultimative...

[ Next Thread | Previous Thread | Next Message | Previous Message ]


Replies:


[ Contact Forum Admin ]


Forum timezone: GMT-5
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.