howto run commonqt asynchronously

Stas Boukarev stassats at gmail.com
Mon Dec 28 21:54:09 UTC 2015


All the GUI stuff has to be done from the same thread (and on some
OSes it has to be the main thread).
To communicate with Qt from a different thread use Qt signals, they
are thread-safe.

On Mon, Dec 28, 2015 at 11:19 PM, Orm Finnendahl
<orm.finnendahl at selma.hfmdk-frankfurt.de> wrote:
>
>
> On Dec 28, 2015 2:32 PM, "Stas Boukarev" <stassats at gmail.com> wrote:
>>
>> Just use multiple threads.
>
> Can you provide an example?
>
> I tried using a thread and it didn't work as expected. Here is what I
> tried:
>
>     CL-USER> (ql:quickload "qt-tutorial")
>     To load "qt-tutorial":
>       Load 1 ASDF system:
>         qt-tutorial
>     ; Loading "qt-tutorial"
>     ....
>     ("qt-tutorial")
>     CL-USER> (defparameter *mythread* (sb-thread:make-thread #'qt-conv::main))
>     *MYTHREAD*
>     CL-USER>
>
> So far, so good: The window opens and I can evaluate in the
> repl. After closing the window, the thread finishes, but it is
> impossible, to open a new window. Reevaluating (qt-conv::main)
> immediately returns -1 (in contrast to it returning 0 in the first
> case after window closing).
>
> In addition, I don't know, how to access the window in the
> thread. Would it be feasible to install a polling queue mechanism
> (e.g. using Mailbox in sbcl) within the thread which sends to the
> application and receives from the repl?
>
> --
> Orm
>



-- 
With best regards, Stas.



More information about the commonqt-devel mailing list