On 12 Sep 2008 at 0:15, Ck wrote: > But program's API is not threadsafe. And I must call API functions from > the dll thread. > > In dll many threads with calculations and some GUI windows. > > Worker thread must call API functions (but it can't). > I decided to send events/messages to main dll thread so API can be > safely called. > > How I can attached to dll thread? > Can i receive in main (dll) thread event form worker thread? > > I use MFC, TnFOX-0.88-FOXv1.6.33, MCVC++ 2005. > > PS Sorry for english)
TnFOX copies the Windows model, so each thread has its own window stack which only it can access. Multiple threads can have multiple window stacks. As you correctly point out, if a worker thread wishes to access a window stack belonging to a different thread, it must post a message to that thread using TnFXApp::postAsyncMessage() or more conveniently wndh->getEventLoop()->postAsyncMessage(). If your main thread is a MFC thread, then you'll need to pump the FOX message dispatch system manually from within the MFC message loop. Does this help? Your email was a bit unclear. Cheers, Niall ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Tnfox-discussion mailing list Tnfox-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tnfox-discussion