Add the quit() method to HttpAppFramework
This commit is contained in:
parent
2f6448e6b2
commit
6698929a70
|
@ -61,7 +61,35 @@ inline std::string getGitCommit()
|
|||
class HttpAppFramework : public trantor::NonCopyable
|
||||
{
|
||||
public:
|
||||
///Get the instance of HttpAppFramework
|
||||
/**
|
||||
* HttpAppFramework works at singleton mode, so any calling of this
|
||||
* method will get the same instance;
|
||||
* Calling drogon::HttpAppFramework::instance()
|
||||
* can be replaced by a simple interface -- drogon::app()
|
||||
*/
|
||||
static HttpAppFramework &instance();
|
||||
|
||||
///Run the event loop
|
||||
/**
|
||||
* Calling this method will start the event loop which drive the network;
|
||||
* The thread calling this method must be the first thread to call instance() method;
|
||||
* Usually the thread calling this method is main thread of the application;
|
||||
*/
|
||||
virtual void run() = 0;
|
||||
|
||||
///Quit the event loop
|
||||
/**
|
||||
* Calling this method will result in stopping all network IO in the
|
||||
* framework and interrupting the blocking of the run() method. Usually,
|
||||
* after calling this method, the application will exit.
|
||||
*
|
||||
* NOTE:
|
||||
* This method can be called in any thread and anywhere.
|
||||
* This method should not be called before calling run().
|
||||
*/
|
||||
virtual void quit() = 0;
|
||||
|
||||
virtual void setThreadNum(size_t threadNum) = 0;
|
||||
virtual void setSSLFiles(const std::string &certPath,
|
||||
const std::string &keyPath) = 0;
|
||||
|
@ -70,7 +98,7 @@ class HttpAppFramework : public trantor::NonCopyable
|
|||
bool useSSL = false,
|
||||
const std::string &certFile = "",
|
||||
const std::string &keyFile = "") = 0;
|
||||
virtual void run() = 0;
|
||||
|
||||
virtual ~HttpAppFramework();
|
||||
virtual void registerWebSocketController(const std::string &pathName,
|
||||
const std::string &crtlName,
|
||||
|
|
|
@ -85,6 +85,11 @@ class HttpAppFrameworkImpl : public HttpAppFramework
|
|||
}
|
||||
|
||||
trantor::EventLoop *loop();
|
||||
virtual void quit() override
|
||||
{
|
||||
assert(_loop.isRunning());
|
||||
_loop.quit();
|
||||
}
|
||||
#if USE_POSTGRESQL
|
||||
virtual orm::DbClientPtr getDbClient(const std::string &name = "default") override;
|
||||
virtual void createDbClient(const std::string &dbType,
|
||||
|
|
2
trantor
2
trantor
|
@ -1 +1 @@
|
|||
Subproject commit fe51026dd655621885555aa2eaa155122cadc813
|
||||
Subproject commit 33cd9c748e5b462714f8d35f29ecb78c2046594a
|
Loading…
Reference in New Issue