summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-29 02:51:13 +0000
committerukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-29 02:51:13 +0000
commit1aee9e0dc1b5319f6402f9362eecb359bccaf406 (patch)
treeeb0092d3d83a0b79b08cdeafed9ba305d9cf22e5 /net
parent4c6890190bc155e0a4350d56e5619b5befac56e5 (diff)
downloadchromium_src-1aee9e0dc1b5319f6402f9362eecb359bccaf406.zip
chromium_src-1aee9e0dc1b5319f6402f9362eecb359bccaf406.tar.gz
chromium_src-1aee9e0dc1b5319f6402f9362eecb359bccaf406.tar.bz2
Detach verify thread from NSPR on linux.
The threads in our thread pool terminate after we have called PR_Cleanup. Unless we detach them from NSPR, if we use CertVerifier, net_unittests dies with segfault on shutdown. BUG=10911 TEST=net_unittests passes with code that uses CertVerifier. Review URL: http://codereview.chromium.org/115856 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17160 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/cert_verifier.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/base/cert_verifier.cc b/net/base/cert_verifier.cc
index 567ea38..e907e30 100644
--- a/net/base/cert_verifier.cc
+++ b/net/base/cert_verifier.cc
@@ -4,6 +4,10 @@
#include "net/base/cert_verifier.h"
+#if defined(OS_LINUX)
+#include <private/pprthred.h> // PR_DetatchThread
+#endif
+
#include "base/message_loop.h"
#include "base/worker_pool.h"
#include "net/base/cert_verify_result.h"
@@ -36,6 +40,16 @@ class CertVerifier::Request :
void DoVerify() {
// Running on the worker thread
error_ = cert_->Verify(hostname_, rev_checking_enabled_, &result_);
+#if defined(OS_LINUX)
+ // Detach the thread from NSPR.
+ // Calling NSS functions attaches the thread to NSPR, which stores
+ // the NSPR thread ID in thread-specific data.
+ // The threads in our thread pool terminate after we have called
+ // PR_Cleanup. Unless we detach them from NSPR, net_unittests gets
+ // segfaults on shutdown when the threads' thread-specific data
+ // destructors run.
+ PR_DetachThread();
+#endif
Task* reply = NewRunnableMethod(this, &Request::DoCallback);