Re: Multi-threaded wrapping
William S Fulton <[email protected]> Mon, 19 Sep 2022 17:48:53 +0100
| Newsgroups | gmane.comp.programming.swig |
|---|---|
| Message-ID | <CANGqftDEvLzXsH1P9PfJieqg0ZmGXx1V3xLOHW5Jvc_oap2_9A@mail.gmail.com> |
On Mon, 12 Sept 2022 at 18:55, Rob McDonald <[email protected]> wrote: > I have a C++ application with an event driven GUI (using FLTK) that is > currently wrapped with Swig for Python. > > I can make calls (with no GUI loaded) to the exposed API. I can also > launch the GUI from Python (and FLTK event loop) and interact with the > graphical program for a while -- when satisfied, I can terminate the event > loop to return control to Python. > > I would like to be able to leave the application GUI active (event loop > still running) and return control to Python. The Python side might > actually be a separate GUI with its own event loop. The two loops will > need to communicate occasionally -- I can likely initiate all communication > from the Python side. > > I believe I will need to run Swig with the 'threads' option. I also need > to set up some sort of lock so the C++ event loop pauses when the C++ API > is responding to a request from the Python side. > > Can anyone give any pointers on how to achieve this? Are there any > examples of this available online? > > There is an example of the 'threads' option in the SWIG test-suite. See https://github.com/swig/swig/blob/master/Examples/test-suite/python_threads.i with associated runtime test https://github.com/swig/swig/blob/master/Examples/test-suite/python/python_threads_runme.py. That's all I can find. William _______________________________________________ Swig-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/swig-user