Synchronize or invoke?

S

Sonnich Jensen

Hi all

In my thread, I'd like to call an event in my main component.
I have a components, which is basically just an interface for my
thread, so the main programme can run freely. Passing data on to the
thread is not a problem, but I recall from Delphi this Synchronize.

It works by setting up a message to the windows queue, which means
rather than invoke, that the thread will go immediately on. When
windows runs through the queue, my procedure will eventually be
called, so I can do what I need, e.g. an event to the main programme.

Say, we have a stress signal. This does not stop the thread, but a
message in the main GUI for user would be appropriate So the thread
synchronizes this to my component, which will call the event. The main
programme will the react to the event (out of my hands)

The invoke seems to wait for the "event" to be done, which is really
not thread safe.

How do I accomplish this?

WBR
Sonnich
 
S

Sonnich Jensen

Hi all

In my thread, I'd like to call an event in my main component.
I have a components, which is basically just an interface for my
thread, so the main programme can run freely. Passing data on to the
thread is not a problem, but I recall from Delphi this Synchronize.

It works by setting up a message to the windows queue, which means
rather than invoke, that the thread will go immediately on. When
windows runs through the queue, my procedure will eventually be
called, so I can do what I need, e.g. an event to the main programme.

Say, we have a stress signal. This does not stop the thread, but a
message in the main GUI for user would be appropriate So the thread
synchronizes this to my component, which will call the event. The main
programme will the react to the event (out of my hands)

The invoke seems to wait for the "event" to be done, which is really
not thread safe.

How do I accomplish this?

WBR
Sonnich

host.BeginInvoke(host.aa);

seems to be it
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top