Boost Threads & WxWidgets Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
calm
In need of some credit
In need of some credit
Posts: 5
Joined: Tue Sep 08, 2009 3:22 pm

Boost Threads & WxWidgets

Post by calm »

Hello

I am trying to launch a boost thread calling a function.

Code: Select all

boost::thread athread( TheProject::thefunction
 , thevalue );
Any idea how I can get this to work?
It's not an issue on a non wxwidgets function, so I am lacking a pointer or something. Unsure but please any help is of great use. Thank you.
calm
In need of some credit
In need of some credit
Posts: 5
Joined: Tue Sep 08, 2009 3:22 pm

Post by calm »

The issue is generating

no matching function for call to `boost::thread::thread(<unknown type>, wxString&)

If that helps out with this.
Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria »

Moved because this is linked to boost, not wx
"Keyboard not detected. Press F1 to continue"
-- Windows
calm
In need of some credit
In need of some credit
Posts: 5
Joined: Tue Sep 08, 2009 3:22 pm

Post by calm »

I guess in a sense yes.
It's the wx function that I can't call though.

a standard void function() executes in the tread just fine.
Not a function derived from the wx class though.
Frank
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 211
Joined: Sat Jan 01, 2005 6:19 pm

Post by Frank »

If it's a memberfunction your're calling, you need to take into consideration that a member needs the pointer to it's instance.

Try this:

boost::thread athread(boost::bind(&TheProject::thefunction, ptrToInstance, thevalue));

ptrToInstance is the this-pointer from the class
calm
In need of some credit
In need of some credit
Posts: 5
Joined: Tue Sep 08, 2009 3:22 pm

Post by calm »

Thank you

Just need this in place of the ptrToInstance. Perfect.
Post Reply