From: Yehuda Sadeh Date: Tue, 3 May 2016 17:02:02 +0000 (-0700) Subject: rgw: RGWHTTPManager, can call stop() more than once X-Git-Tag: v11.0.0~611^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=bdce81a2ae00f154420386e107a104cbf100d96d;p=ceph.git rgw: RGWHTTPManager, can call stop() more than once destructor calls stop(), but it can be also called explicitly, if caller wants to ensure requests are not being handled anymore. Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_http_client.cc b/src/rgw/rgw_http_client.cc index 56540d95ea0f..80f3e4e13144 100644 --- a/src/rgw/rgw_http_client.cc +++ b/src/rgw/rgw_http_client.cc @@ -562,6 +562,12 @@ int RGWHTTPManager::set_threaded() void RGWHTTPManager::stop() { + if (is_stopped.read()) { + return; + } + + is_stopped.set(1); + if (is_threaded) { going_down.set(1); signal_thread(); diff --git a/src/rgw/rgw_http_client.h b/src/rgw/rgw_http_client.h index c31af9fa7da3..1d69cedfe39f 100644 --- a/src/rgw/rgw_http_client.h +++ b/src/rgw/rgw_http_client.h @@ -110,6 +110,7 @@ class RGWHTTPManager { void *multi_handle; bool is_threaded; atomic_t going_down; + atomic_t is_stopped; RWLock reqs_lock; map reqs;