Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Delphi Misc > Re: Quick threa...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 5 Topic 5967 of 6154
Post > Topic >>

Re: Quick thread question

by "vertuas" <vertuas@[EMAIL PROTECTED] > Jan 23, 2008 at 03:28 PM

"Rob Kennedy" <me3@[EMAIL PROTECTED]
> wrote in message 
news:5vp3diF1n91usU1@[EMAIL PROTECTED]
> vertuas wrote:
>> I an using a 3rd party component to process data.
>>
>> The problem is that the call to the "start processing" method return 
>> emmidiaty and the component fires an event when it finished.
>>
>> Now i need to set up a thread i can run, that sets up a component,
start 
>> processing and then waist for the finished event before terminating.
>
> So that other component creates a thread for itself, too? Why do you
need 
> to make your own thread for all this?
>
>> Can i set up a semaphore in my thread and us WaitForSingleObject??
>
> Sure. But if you really just want to wait until the thread is complete, 
> you can simply wait on the thread handle itself. No need to another 
> synchronization object.
>
> Or you can call the thread's WaitFor method.
>
>> A bit like (if over simplified) :
>
> Sorry, it's oversimplified to the point of being nonsense. How can you 
> hope for someone to fix your code when you don't tell us what you code
is?
>
> Also, make sure you mention what you're having trouble with.
>
>> Var threadEvent : TEvent;
>>
>> procedure TThread.Execute;
>> begin
>>     //Setup processing
>>     //Start processing
>>     ..........
>>     TEvent.create;
>>     WaitForSingleObject(theadEvent, 600000);
>>     ..........
>>     //Free process
>> end;
>>
>> procedure THread.OnProcessDone;
>> begin
>>     TEvent.reset;
>> end;
>
>
> -- 
> Rob

Thanks for that Rob.  The component must create its own thread, to
continue 
processing.

After i have prcessed my data i need to use to data, i can't do that until

it has finished processing it.

I can't use a loop in the VCL to wait for the the result, as the whole 
application window will lock up. So i need to create another thread just
to 
do the waiting. keeping the application responding.

I tryed to use a loop in the thread, but the thread never exits due to
being 
stuck in a loop.  So i am looping for something else.
 




 5 Posts in Topic:
Quick thread question
"vertuas" <v  2008-01-23 08:13:03 
Re: Quick thread question
Rob Kennedy <me3@[EMAI  2008-01-23 09:05:20 
Re: Quick thread question
"vertuas" <v  2008-01-23 15:28:07 
Re: Quick thread question
Rob Kennedy <me3@[EMAI  2008-01-23 19:45:59 
Re: Quick thread question
mdR <mrafn@[EMAIL PROT  2008-01-23 09:43:53 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 20:14:31 CDT 2008.