Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > VCL

Lost Password?

Thread Tools Display Modes
Old 09-03-2015, 01:33 PM
rojam rojam is offline
Senior Member
Join Date: Jun 2015
Posts: 199

Originally Posted by lexd View Post
So I cannot replace sleep with with suspend
I think that is not true in reality as I test it
And its a pain to the object should I only need a simple read of the stream and reload more data
There is a big difference between sleep and suspend. Sleep will only block your thread for the time period that it is sleeping. Sleeping for one second still makes your thread responsive, as in it will respond to new read/write task given and also request for it to terminate all within one second.

If you suspend your thread, it is unresponsive, until you resume, so if you replace sleep with suspend, then when you tell it to terminate in your stream object's destroy method, it will not respond - because it is suspended.

Having a thread sleep won't block your stream object, nor the application that is using it, just the thread itself since the sleep operation is being done in that thread.

Last edited by rojam; 09-03-2015 at 05:45 PM.
Reply With Quote

delphi 7, thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 08:14 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.