SECStatus sslMutex_Destroy(sslMutex *pMutex) { HANDLE hMutex; int rv; int retvalue = SECSuccess; PR_ASSERT(pMutex != 0); if (PR_FALSE == pMutex->isMultiProcess) { return single_process_sslMutex_Destroy(pMutex); } /* multi-process mode */ #ifdef WINNT /* on NT, get rid of the PRLock used for fibers within a process */ retvalue = sslMutex_2LevelDestroy(pMutex); #endif PR_ASSERT( pMutex->u.sslMutx != 0 && pMutex->u.sslMutx != INVALID_HANDLE_VALUE); if (!pMutex || (hMutex = pMutex->u.sslMutx) == 0 || hMutex == INVALID_HANDLE_VALUE) { PORT_SetError(PR_INVALID_ARGUMENT_ERROR); return SECFailure; } rv = CloseHandle(hMutex); /* ignore error */ if (rv) { pMutex->u.sslMutx = hMutex = INVALID_HANDLE_VALUE; } else { nss_MD_win32_map_default_error(GetLastError()); retvalue = SECFailure; } return retvalue; }
SECStatus sslMutex_Destroy(sslMutex *pMutex, PRBool processLocal) { HANDLE hMutex; int rv; int retvalue = SECSuccess; PR_ASSERT(pMutex != 0); if (PR_FALSE == pMutex->isMultiProcess) { return single_process_sslMutex_Destroy(pMutex); } #ifdef WINNT retvalue = sslMutex_2LevelDestroy(pMutex); #endif PR_ASSERT( pMutex->u.sslMutx != 0 && pMutex->u.sslMutx != INVALID_HANDLE_VALUE); if (!pMutex || (hMutex = pMutex->u.sslMutx) == 0 || hMutex == INVALID_HANDLE_VALUE) { PORT_SetError(PR_INVALID_ARGUMENT_ERROR); return SECFailure; } rv = CloseHandle(hMutex); if (!processLocal && rv) { pMutex->u.sslMutx = hMutex = INVALID_HANDLE_VALUE; } if (!rv) { nss_MD_win32_map_default_error(GetLastError()); retvalue = SECFailure; } return retvalue; }