supamii / QttpServer

Build your API with C++ - Powered by Qt and Node's libuv
https://supamii.github.io/qttpserver/
MIT License
103 stars 35 forks source link

Cannot run it inside a pthread. #19

Open sombralibre opened 7 years ago

sombralibre commented 7 years ago

I've tried to get qttp server to run inside a thread created with pthread, however doesn't works. But if I call qttp server from main function, all works fine.

Any advices about how to fix it.

Thanks.

supamii commented 7 years ago

Apologies for the delay - just returned.

So startServer already starts everything up in its own thread. Any reason why you need your own pthread?

To actually answer your question though... The issue is probably due to the fact that a pthread is not hooked into qt's main function - as you have already noted. If you are unable to declare/instantiate QttpServer from the qtmain thread then we might have a special case to work-around.