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.
calm
In need of some credit
Posts: 5 Joined: Tue Sep 08, 2009 3:22 pm
Post
by calm » Tue Sep 08, 2009 3:27 pm
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
Posts: 5 Joined: Tue Sep 08, 2009 3:22 pm
Post
by calm » Tue Sep 08, 2009 8:40 pm
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
Posts: 6695 Joined: Thu Sep 28, 2006 12:23 am
Contact:
Post
by Auria » Tue Sep 08, 2009 8:55 pm
Moved because this is linked to boost, not wx
"Keyboard not detected. Press F1 to continue"
-- Windows
calm
In need of some credit
Posts: 5 Joined: Tue Sep 08, 2009 3:22 pm
Post
by calm » Tue Sep 08, 2009 11:41 pm
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
Posts: 211 Joined: Sat Jan 01, 2005 6:19 pm
Post
by Frank » Wed Sep 09, 2009 9:51 am
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
Posts: 5 Joined: Tue Sep 08, 2009 3:22 pm
Post
by calm » Wed Sep 23, 2009 8:30 am
Thank you
Just need this in place of the ptrToInstance. Perfect.