embed - libuv event loop in qt -


is there way without using multiple threads?

i found https://stackoverflow.com/a/17329626/4014896

but don't how works. shouldn't cause 100% cpu usage in example? , how can embed it, example, qt?

there this: https://github.com/svalaskevicius/qt-event-dispatcher-libuv there no documentation @ all. looks seems translates example qsocket uv_tcp_socket not i'm searching for.

in short - you'll either need merge 2 event loops or use separate threads , sync event handlers manually..

the first link pasted shows how process libuv events have happened since last invocation. while stated there use ~100% cpu if there no events dispatched (as keep polling).

the second link (qt-event-dispatcher-libuv) project i've created tackle same problem. does, however, work described - using libuv handle qt's event loop (and doing - merges 2 event loops one).

to use you'd need register event dispatcher in application using http://qt-project.org/doc/qt-5/qcoreapplication.html#seteventdispatcher. example library used - https://github.com/svalaskevicius/qtjs-generator/blob/master/src/runner/main.cpp#l179

there still 1 catch using approach - while works on linux, there problems on os x qt's cocoa platform support plugin handles cocoa's event loop operations , doesn't provide nice api merge (currently updating them 1 freed after small timeout there (barely?) noticeable lag handle gui events) - planning port platform support plugin able integrate that's still in future. , haven't tested on windows yet :)

an alternative solution try merge 2 loops direction i've done - instead of making qt use libuv, libuv's api provided uses qt's handlers - although requires considerable amount of work well.

please let me know if there more info provide.

regards,


Comments

Popular posts from this blog

PHP Error "Undefined index" -

C# List<> to xml -