Commit 1aee9e0d authored by ukai@chromium.org's avatar ukai@chromium.org

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
parent 4c689019
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment