"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.


|