mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
[XPCOM] xpcom/threads misc cleanup
This commit is contained in:
parent
94cafe3a4a
commit
7de4e86727
3 changed files with 24 additions and 11 deletions
|
|
@ -137,10 +137,15 @@ LazyIdleThread::EnsureThread()
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_ASSERT(!mPendingEventCount, "Shouldn't have events yet!");
|
#ifdef DEBUG
|
||||||
MOZ_ASSERT(!mIdleNotificationCount, "Shouldn't have idle events yet!");
|
{ // Lock scope
|
||||||
MOZ_ASSERT(!mIdleTimer, "Should have killed this long ago!");
|
MutexAutoLock lock(mMutex);
|
||||||
MOZ_ASSERT(!mThreadIsShuttingDown, "Should have cleared that!");
|
MOZ_ASSERT(!mPendingEventCount, "Shouldn't have events yet!");
|
||||||
|
MOZ_ASSERT(!mIdleNotificationCount, "Shouldn't have idle events yet!");
|
||||||
|
MOZ_ASSERT(!mIdleTimer, "Should have killed this long ago!");
|
||||||
|
MOZ_ASSERT(!mThreadIsShuttingDown, "Should have cleared that!");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,9 +152,10 @@ private:
|
||||||
nsCOMPtr<nsIThread> mThread;
|
nsCOMPtr<nsIThread> mThread;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Protected by mMutex. Created when mThread has no pending events and fired
|
* Created when mThread has no pending events and fired
|
||||||
* at mOwningThread. Any thread that dispatches to mThread will take ownership
|
* at mOwningThread. Any thread that dispatches to mThread will take ownership
|
||||||
* of the timer and fire a separate cancel event to the owning thread.
|
* of the timer and fire a separate cancel event to the owning thread.
|
||||||
|
* Only accessed from the owning thread.
|
||||||
*/
|
*/
|
||||||
nsCOMPtr<nsITimer> mIdleTimer;
|
nsCOMPtr<nsITimer> mIdleTimer;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -280,10 +280,13 @@ nsProcess::ProcessComplete()
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* topic;
|
const char* topic;
|
||||||
if (mExitValue < 0) {
|
{ // Lock scope
|
||||||
topic = "process-failed";
|
MutexAutoLock lock(mLock);
|
||||||
} else {
|
if (mExitValue < 0) {
|
||||||
topic = "process-finished";
|
topic = "process-failed";
|
||||||
|
} else {
|
||||||
|
topic = "process-finished";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mPid = -1;
|
mPid = -1;
|
||||||
|
|
@ -412,8 +415,11 @@ nsProcess::RunProcess(bool aBlocking, char** aMyArgv, nsIObserver* aObserver,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mExitValue = -1;
|
{
|
||||||
mPid = -1;
|
MutexAutoLock lock(mLock);
|
||||||
|
mExitValue = -1;
|
||||||
|
mPid = -1;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(PROCESSMODEL_WINAPI)
|
#if defined(PROCESSMODEL_WINAPI)
|
||||||
BOOL retVal;
|
BOOL retVal;
|
||||||
|
|
@ -477,6 +483,7 @@ nsProcess::RunProcess(bool aBlocking, char** aMyArgv, nsIObserver* aObserver,
|
||||||
mBlocking = aBlocking;
|
mBlocking = aBlocking;
|
||||||
if (aBlocking) {
|
if (aBlocking) {
|
||||||
Monitor(this);
|
Monitor(this);
|
||||||
|
MutexAutoLock lock(mLock);
|
||||||
if (mExitValue < 0) {
|
if (mExitValue < 0) {
|
||||||
return NS_ERROR_FILE_EXECUTION_FAILED;
|
return NS_ERROR_FILE_EXECUTION_FAILED;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue