mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backout changeset 05fe748d2031 (bug 468736) on the suspicion of 400% Tshutdown regression, landed on a CLOSED TREE
This commit is contained in:
parent
b8ba7ce477
commit
e62cc2c992
@ -133,14 +133,13 @@ void nsCertVerificationThread::Run(void)
|
||||
{
|
||||
MutexAutoLock threadLock(verification_thread_singleton->mMutex);
|
||||
|
||||
while (mExitState == ePSMThreadRunning &&
|
||||
(0 == verification_thread_singleton->mJobQ.GetSize())) {
|
||||
while (!mExitRequested && (0 == verification_thread_singleton->mJobQ.GetSize())) {
|
||||
// no work to do ? let's wait a moment
|
||||
|
||||
mCond.Wait();
|
||||
}
|
||||
|
||||
if (mExitState != ePSMThreadRunning)
|
||||
if (mExitRequested)
|
||||
break;
|
||||
|
||||
job = static_cast<nsBaseVerificationJob*>(mJobQ.PopFront());
|
||||
@ -161,7 +160,6 @@ void nsCertVerificationThread::Run(void)
|
||||
static_cast<nsCertVerificationJob*>(mJobQ.PopFront());
|
||||
delete job;
|
||||
}
|
||||
verification_thread_singleton->mExitState = ePSMThreadStopped;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -398,12 +398,14 @@ nsNSSComponent::~nsNSSComponent()
|
||||
{
|
||||
mSSLThread->requestExit();
|
||||
delete mSSLThread;
|
||||
mSSLThread = nsnull;
|
||||
}
|
||||
|
||||
if (mCertVerificationThread)
|
||||
{
|
||||
mCertVerificationThread->requestExit();
|
||||
delete mCertVerificationThread;
|
||||
mCertVerificationThread = nsnull;
|
||||
}
|
||||
|
||||
PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent::dtor\n"));
|
||||
@ -2532,18 +2534,11 @@ nsNSSComponent::DoProfileBeforeChange(nsISupports* aSubject)
|
||||
void
|
||||
nsNSSComponent::DoProfileChangeNetRestore()
|
||||
{
|
||||
/* XXX this doesn't work well, since nothing expects null pointers */
|
||||
if (mSSLThread) {
|
||||
mSSLThread->requestExit();
|
||||
delete mSSLThread;
|
||||
}
|
||||
mSSLThread = new nsSSLThread();
|
||||
if (mSSLThread)
|
||||
mSSLThread->startThread();
|
||||
if (mCertVerificationThread) {
|
||||
mCertVerificationThread->requestExit();
|
||||
delete mCertVerificationThread;
|
||||
}
|
||||
mCertVerificationThread = new nsCertVerificationThread();
|
||||
if (mCertVerificationThread)
|
||||
mCertVerificationThread->startThread();
|
||||
|
@ -36,7 +36,6 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsPSMBackgroundThread.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -50,7 +49,7 @@ nsPSMBackgroundThread::nsPSMBackgroundThread()
|
||||
: mThreadHandle(nsnull),
|
||||
mMutex("nsPSMBackgroundThread.mMutex"),
|
||||
mCond(mMutex, "nsPSMBackgroundThread.mCond"),
|
||||
mExitState(ePSMThreadRunning)
|
||||
mExitRequested(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
@ -71,13 +70,6 @@ nsPSMBackgroundThread::~nsPSMBackgroundThread()
|
||||
{
|
||||
}
|
||||
|
||||
PRUint32 nsPSMBackgroundThread::GetExitStateThreadSafe()
|
||||
{
|
||||
MutexAutoLock threadLock(mMutex);
|
||||
|
||||
return mExitState;
|
||||
}
|
||||
|
||||
void nsPSMBackgroundThread::requestExit()
|
||||
{
|
||||
if (!mThreadHandle)
|
||||
@ -86,21 +78,13 @@ void nsPSMBackgroundThread::requestExit()
|
||||
{
|
||||
MutexAutoLock threadLock(mMutex);
|
||||
|
||||
if (mExitState != ePSMThreadRunning)
|
||||
if (mExitRequested)
|
||||
return;
|
||||
|
||||
mExitState = ePSMThreadStopRequested;
|
||||
mExitRequested = PR_TRUE;
|
||||
mCond.NotifyAll();
|
||||
}
|
||||
|
||||
// We cannot rely on posting/processing events at this point, because the
|
||||
// event loop has already terminated by the time we reach here.
|
||||
while (GetExitStateThreadSafe() < ePSMThreadStopped) {
|
||||
NS_ProcessNextEvent(nsnull, PR_FALSE);
|
||||
if (GetExitStateThreadSafe() < ePSMThreadStopped)
|
||||
PR_Sleep(PR_SecondsToInterval(5));
|
||||
}
|
||||
|
||||
PR_JoinThread(mThreadHandle);
|
||||
mThreadHandle = nsnull;
|
||||
}
|
||||
|
@ -43,12 +43,6 @@
|
||||
#include "mozilla/CondVar.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
||||
enum {
|
||||
ePSMThreadRunning = 0,
|
||||
ePSMThreadStopRequested = 1,
|
||||
ePSMThreadStopped = 2
|
||||
};
|
||||
|
||||
class nsPSMBackgroundThread
|
||||
{
|
||||
protected:
|
||||
@ -59,7 +53,7 @@ protected:
|
||||
PRThread *mThreadHandle;
|
||||
|
||||
// Shared mutex used for condition variables,
|
||||
// and to protect access to mExitState.
|
||||
// and to protect access to mExitRequested.
|
||||
// Derived classes may use it to protect additional
|
||||
// resources.
|
||||
mozilla::Mutex mMutex;
|
||||
@ -68,7 +62,7 @@ protected:
|
||||
mozilla::CondVar mCond;
|
||||
|
||||
// Has termination of the SSL thread been requested?
|
||||
PRUint32 mExitState;
|
||||
PRBool mExitRequested;
|
||||
|
||||
public:
|
||||
nsPSMBackgroundThread();
|
||||
@ -76,9 +70,6 @@ public:
|
||||
|
||||
nsresult startThread();
|
||||
void requestExit();
|
||||
|
||||
private:
|
||||
PRUint32 GetExitStateThreadSafe();
|
||||
};
|
||||
|
||||
|
||||
|
@ -510,7 +510,7 @@ PRInt32 nsSSLThread::requestRead(nsNSSSocketInfo *si, void *buf, PRInt32 amount,
|
||||
{
|
||||
MutexAutoLock threadLock(ssl_thread_singleton->mMutex);
|
||||
|
||||
if (ssl_thread_singleton->mExitState != ePSMThreadRunning) {
|
||||
if (ssl_thread_singleton->mExitRequested) {
|
||||
PR_SetError(PR_UNKNOWN_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
@ -737,7 +737,7 @@ PRInt32 nsSSLThread::requestWrite(nsNSSSocketInfo *si, const void *buf, PRInt32
|
||||
{
|
||||
MutexAutoLock threadLock(ssl_thread_singleton->mMutex);
|
||||
|
||||
if (ssl_thread_singleton->mExitState != ePSMThreadRunning) {
|
||||
if (ssl_thread_singleton->mExitRequested) {
|
||||
PR_SetError(PR_UNKNOWN_ERROR, 0);
|
||||
return -1;
|
||||
}
|
||||
@ -958,7 +958,7 @@ void nsSSLThread::Run(void)
|
||||
continue; // go back and finally destroy it, before doing anything else
|
||||
}
|
||||
|
||||
if (mExitState != ePSMThreadRunning)
|
||||
if (mExitRequested)
|
||||
break;
|
||||
|
||||
PRBool pending_work = PR_FALSE;
|
||||
@ -981,12 +981,12 @@ void nsSSLThread::Run(void)
|
||||
mCond.Wait();
|
||||
}
|
||||
|
||||
} while (!pending_work && mExitState == ePSMThreadRunning && !mSocketScheduledToBeDestroyed);
|
||||
} while (!pending_work && !mExitRequested && !mSocketScheduledToBeDestroyed);
|
||||
|
||||
if (mSocketScheduledToBeDestroyed)
|
||||
continue;
|
||||
|
||||
if (mExitState != ePSMThreadRunning)
|
||||
if (mExitRequested)
|
||||
break;
|
||||
|
||||
if (!pending_work)
|
||||
@ -1134,7 +1134,6 @@ void nsSSLThread::Run(void)
|
||||
PR_SetPollableEvent(nsSSLIOLayerHelpers::mSharedPollableEvent);
|
||||
}
|
||||
}
|
||||
ssl_thread_singleton->mExitState = ePSMThreadStopped;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1145,7 +1144,7 @@ PRBool nsSSLThread::exitRequested()
|
||||
|
||||
// no lock
|
||||
|
||||
return ssl_thread_singleton->mExitState != ePSMThreadRunning;
|
||||
return ssl_thread_singleton->mExitRequested;
|
||||
}
|
||||
|
||||
nsSSLThread *nsSSLThread::ssl_thread_singleton = nsnull;
|
||||
|
Loading…
Reference in New Issue
Block a user