Search code examples
processwxwidgets

Running long processes inside threads in wxwidgets


Can anyone please provide me with some tutorials, explaining running processes inside threads. I mean process control, with in wxwidgets. I'm trying to implement a gui for a console application.


Solution

  • Some points to remember:

    • The main thread is special and is the only one which can support the GUI. Worker threads can however prepare bitmaps and then use AddPendingEvent or QueueEvent to tell the main thread they have data it can use.
    • Never free an area of memory in a different thread from the thread in which you allocated it.
    • wxString is not thread safe. It is risky to use it to communicate between threads.