diff options
author | Monty Brandenberg <monty@lindenlab.com> | 2012-06-23 23:33:50 -0400 |
---|---|---|
committer | Monty Brandenberg <monty@lindenlab.com> | 2012-06-23 23:33:50 -0400 |
commit | e172ec84fa217aae8d1e51c1e0673322c30891fe (patch) | |
tree | 7a9991fdcc625acba60a2eb205735baa0b9c1b9a /indra/llcorehttp/_httplibcurl.h | |
parent | bc7d5b24d16963a2715e880c518a4706a99f02fa (diff) |
SH-3184/SH-3221 Improve cleanup, destructor, thread termination, etc. logic in library.
With this commit, the cleanup paths should be production quality. Unit tests have been
expanded to include cases requiring thread termination and cleanup by the worker thread.
Special operation/request added to support the unit tests. Thread interface expanded
to include a very aggressive cancel() method that does not do cleanup but prevents the
thread from accessing objects that will be destroyed.
Diffstat (limited to 'indra/llcorehttp/_httplibcurl.h')
-rw-r--r-- | indra/llcorehttp/_httplibcurl.h | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/indra/llcorehttp/_httplibcurl.h b/indra/llcorehttp/_httplibcurl.h index 5e1dd1bfbf..69f7bb2b6d 100644 --- a/indra/llcorehttp/_httplibcurl.h +++ b/indra/llcorehttp/_httplibcurl.h @@ -65,9 +65,6 @@ private: void operator=(const HttpLibcurl &); // Not defined public: - static void init(); - static void term(); - /// Give cycles to libcurl to run active requests. Completed /// operations (successful or failed) will be retried or handed /// over to the reply queue as final responses. @@ -79,16 +76,23 @@ public: void addOp(HttpOpRequest * op); /// One-time call to set the number of policy classes to be - /// serviced and to create the resources for each. - void setPolicyCount(int policy_count); + /// serviced and to create the resources for each. Value + /// must agree with HttpPolicy::setPolicies() call. + void start(int policy_count); + + void shutdown(); int getActiveCount() const; int getActiveCountInClass(int policy_class) const; - + protected: /// Invoked when libcurl has indicated a request has been processed /// to completion and we need to move the request to a new state. bool completeRequest(CURLM * multi_handle, CURL * handle, CURLcode status); + + /// Invoked to cancel an active request, mainly during shutdown + /// and destroy. + void cancelRequest(HttpOpRequest * op); protected: typedef std::set<HttpOpRequest *> active_set_t; |