On Mon, Apr 8, 2013 at 7:23 AM, Javier Mr <javiersdevm...@ymail.com> wrote: > Hi, > > i'm getting a crash when running my app and i wonder if i'm doing it wrong. > > The situation is like this: > I have a native C++ application wich has a Lua interpreter embedded. This > embedded interpreter load a lua script that contains wxLua. The idea is, the > native code is multithraeded a modifies interal structures (protected with > mutex) and i want to observe that values so i load the lua script with > wxLua.
This sounds reasonable. > I think my problem is that my native app do call the lua state to notify > that changes to the internal data have occur, and the same?¿ lua state is > called by wx as callbacks to the GUI events, could be this the reason for > crash? Is there a way to avoid this? Not ideal but would be OK to do pooling Neither Lua or wxWidgets/wxLua are threadsafe (way too much overhead). I believe it is possible, but I wouldn't recommend running the GUI in a single secondary thread, I would reserve the main thread for that. > in the MainLoop, so i could (every second for example) retrieve the new data > from the native side and update the GUI with the current data. You can use wxPostEvent() to asynchronously send a message from other threads to the GUI thread (though a wxWindow derived class perhaps) notifying them that there is new data to show. You can send any derived wxEvent class and wxEventType (wxEVT_COMMAND_ENTER) you like and use the ID to discriminate your event from anything else. Depending on the size of the data you could even put it into the wxString member of a wxCommandEvent. Regards, John ------------------------------------------------------------------------------ Precog is a next-generation analytics platform capable of advanced analytics on semi-structured data. The platform includes APIs for building apps and a phenomenal toolset for data science. Developers can use our toolset for easy data analysis & visualization. Get a free account! http://www2.precog.com/precogplatform/slashdotnewsletter _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users