MultiThread problem Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
kursist
Knows some wx things
Knows some wx things
Posts: 34
Joined: Thu Mar 15, 2007 8:52 am

MultiThread problem

Post by kursist » Fri Aug 29, 2008 6:42 am

Hi,

I have problem with the multithreading. I have looked at wxThread example. I am not sure if I am doing it the right way.

Here is the Steps in application:

Collect some data from a Grid,
Arrange it in a PDU
Send it via COM port,
Receive the answer,
Update the Grid.

The first tow step is done once, but the next three steps should put in an infinite loop. I am updating the Grid in a thread to prevent window freezing. There is start and stop button for the loop.

It works for one Grid, but with two grid, and two start and stop buttons the application hangs.

When I click on stop. Which thread should be stopped, as it is not placed in thread array in a specific location.

The code is exactly the wxThread example with only Start and Stop.


adv. thanks for you help,

;) meee

Ugly!
Earned some good credits
Earned some good credits
Posts: 113
Joined: Mon May 09, 2005 5:11 am
Location: Argentina - BS AS

Post by Ugly! » Fri Aug 29, 2008 2:05 pm

You should NOT update or deal with any controls directly from the thread. The way to go here would be to have the thread to post an event on the parent. Then add this event to the parent's event table.

I'm also working with serial COM and that's the way it works for me.

Best regards, Matias
Just a newbie - Too many interests, not too many time.

Windows XP SP2
Kubuntu GNU/Linux - Feisty
wxActiveRecordGenerator (aka wxARG) maintainer
Find it at wxCode

Post Reply