Re: [Cppcms-users] CppCMS and QT
Brought to you by:
artyom-beilis
From: Frank E. <fra...@an...> - 2010-12-30 17:14:52
|
Am 30.12.2010 17:01, schrieb Artyom: >> >> hi, >> >> i'm writing a server application which runs cppcms as the server engine, >> but the cppcms applications are written using QT 4.6. This is a >> requirement and can't be changed. >> > > What are you using Qt for? the project depends on the qt datatypes and classes. it does not have an ui, but it uses qt classes and concepts. >> I managed to get everything working except for the thread crossing >> signal/slot mechanism from qt > > If you want to send a signal between CppCMS application and Qt part > you need to use this via either Posting events to each one's main > loop or use other trick. > > Both CppCMS and Qt framework has their event loops. > To use each even loop you need to play by their rules. > > If you want to have separate GUI and HTTP "GUI" you > make them to cooperate by positing events, both Qt > and CppCMS has such tools to do this in thread safe way. > this sounds complicated.. :( > >> and qt timers since they all depend on >> QThreads but the cppcms applications are generated by the cppcms >> application_pool and therefore are (i suppose) more booster threads than >> qt threads. > > Threads are threads... and has nothing to do with Qt or CppCMS - all > pthreads under the hood. > > So if you'll describe requirements in more clear way > or show what is the exact problem you have I probably can help > you but otherwise I don't understand what you need. > my actual problem is that i want to use the QNetworkAccessManager in a cppcms application object to perform an external https call which is required for an authentication to an external 3rd party provider. actually i do something like this in the cppcms application object: QNetworkAccessManager * nmgr = new QNetworkAccessManager(); QNetworkReply * nrep = nmgr->get(QNetworkRequest(url)); if(!nrep->waitForReadyRead(30000)) { // read failed } else { QByteArray json = nrep->readAll(); // do something with the json data.. } when i run this i get the following runtime error from qt: QObject::startTimer: QTimer can only be used with threads started with QThread this must originate inside the waitForReadyRead call since the QNetworkAccessManager works asynchronous.. the problem according to the error message must be that the thread is not created through QThread and therefore misses some supplemental data which hinders QTimer on working. so my first thought was to gt the cppcms application somehow inside a QThread. of course i have no idea if that's possible at all.. >> >> My qeustion is: is it possible to factor the cppcms applications in a >> way that they are QThreads? >> > > CppCMS applications are not threads, they just objects that created > and cached and they called from CppCMS's thread pool upon request > (of course if you talking about synchronous model). > so CppCMS just instances new objects via new - right? (yes, synchronous model) > Asynchonous CppCMS applications are object that interact > via main event loop of CppCMS and called upon HTTP requests. > >> Thanks, >> >> Frank > > Artyom > > > > > ------------------------------------------------------------------------------ > Learn how Oracle Real Application Clusters (RAC) One Node allows customers > to consolidate database storage, standardize their database environment, and, > should the need arise, upgrade to a full multi-node Oracle RAC database > without downtime or disruption > http://p.sf.net/sfu/oracle-sfdevnl > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users -- Dipl.-Ing. (FH) Frank Enderle anamica GmbH Beinsteinerstr. 6 71334 Waiblingen Mobil: +49 151 14981091 Telefon: +49 7151 1351565 1 Telefax: +49 7151 1351565 9 E-Mail: fra...@an... Internet: www.anamica.de Handelsregister: AG Stuttgart HRB 732357 Geschäftsführer: Yvonne Holzwarth, Frank Enderle |