vinipsmaker / tufao

An asynchronous web framework for C++ built on top of Qt
http://vinipsmaker.github.io/tufao/
GNU Lesser General Public License v2.1
591 stars 179 forks source link

Any example on httpserver with threaded(QThread) or ThreadedHttpServer. #51

Open kingctan opened 9 years ago

kingctan commented 9 years ago

I am new to tufao. and have no idea about the thead use of tufao, So, the following code maybe stupid. 1.

    HttpServer *server;

    WebThread webthread(server);  # 

    server->moveToThread(&webthread);

    webthread.start();

run with the fellowing error and exit.

QML debugging is enabled. Only use this in a safe environment.
Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the process directly

2. when using ThreadedHttpServer in the main.cpp, build result show:

E:\...\main.cpp:75: error: undefined reference to `Tufao::ThreadedHttpServer::ThreadedHttpServer(QObject*)'

How?

and if any example about ThreadedHttpServer will be great. and I want to set the Url Route.

Please help,Thanks.

vinipsmaker commented 9 years ago

Are you using a stable Tufão release?

kingctan commented 9 years ago

no, I downloaded from github tufao main page.

vinipsmaker commented 9 years ago

try one of the tagged releases: https://github.com/vinipsmaker/tufao/releases

I guarantee no API/ABI/low-amount-of-bugs over the development branches

btw, there are threads examples:

vinipsmaker commented 9 years ago

reopen the issue if the problem persist

kingctan commented 9 years ago

are you stay on the irc channel?

vinipsmaker commented 9 years ago

are you stay on the irc channel?

sorry, i use an IRC bouncer and i read IRC messages like email, not like IM

i'm there now

kingctan commented 9 years ago

for the kiwiirc's disconnection,maybe we can't see messages for each other now. I'll paste my test here.

1). after tested for several times. found:

QThread: Destroyed while thread is still running 
Error - RtlWerpReportException failed with status code :-1073741823. Will try to launch the process directly 

and quit then.

2). when open url in browser and refresh the browser,the qtcreator will show log:

QObject: Cannot create children for a parent that is in a different thread.
(Parent is Worker(0x1c1de678), parent's thread is QThread(0x1c1dbb90), current thread is QThread(0x1c1f16b0)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is Worker(0x1c1de480), parent's thread is QThread(0x1c1dbbe0), current thread is QThread(0x1c1f16e0)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is Worker(0x1c1de678), parent's thread is QThread(0x1c1dbb90), current thread is QThread(0x1c1f16b0)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is Worker(0x1c1de678), parent's thread is QThread(0x1c1dbb90), current thread is QThread(0x1c1f16b0)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is Worker(0x1c1de678), parent's thread is QThread(0x1c1dbb90), current thread is QThread(0x1c1f16b0)
QObject: Cannot create children for a parent that is in a different thread.
(Parent is Worker(0x1c1de678), parent's thread is QThread(0x1c1dbb90), current thread is QThread(0x1c1f16b0)
vinipsmaker commented 9 years ago

what platform are you using? are you running the same code?

after tested for several times

thanks for the feedback. can you test after this new commit i made seconds ago?

kingctan commented 9 years ago

QT5.3,WIN7,1.x C++11. tested also see:

QObject: Cannot create children for a parent that is in a different thread.
(Parent is Worker(0x1c1de678), parent's thread is QThread(0x1c1dbb90), current thread is QThread(0x1c1f16b0)
vinipsmaker commented 9 years ago

i'd like to help more, but you'll need to take the issue to the upstream qt guys