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
589 stars 179 forks source link

Any doc on using this server with a redis client API? #65

Closed minixxie closed 9 years ago

minixxie commented 9 years ago

Hi, I'd like to try this framework with a redis DB store behind. as I know, this framework is using the Qt event loop, while this api ( https://github.com/nekipelov/redisclient ) is using the boost.asio event loop. It seems to me that it is impossible to integrate two frameworks with two different kinds of event loop. Could you please give me some advice? Thanks & Regards, Simon

vinipsmaker commented 9 years ago

You can schedule calls to run_one from within the Qt event loop. Maybe the other way around is also possible. You can run multiple threads, each with its own event loop.

I haven't tested any of these approaches. These approaches would be my first steps if I had your problem.

minixxie commented 9 years ago

Thank you for your instant reply! Just found a post: http://www.qtcentre.org/threads/53229-How-to-integrate-asio-io_service-with-Qt-event-loop The guy peper0 wrote such project: https://github.com/peper0/qtasio It seems like I could try this? Regards, Simon

vinipsmaker commented 9 years ago

Seems like you found the answer, if you aren't restricted by "must run on Windows", like warned on the forum you mentioned.

minixxie commented 9 years ago

Thank you. We don't use M$ windows for servers. So I'm comfortable with the POSIX compatability.

minixxie commented 9 years ago

May I continue asking about this question? it seems that scheduling calls to run_one is somehow like kind of polling?

vinipsmaker commented 9 years ago

run_one is somehow like kind of polling?

You don't ask which socket is ready, one by one. You ask if there are ready tasks. But I agree that is nonoptimal.

The forum you mentioned already has a discussion on the topic. it's better than I have to offer.