nssSlot_ExitMonitor(slot);
nssSlot_IsTokenPresent(  NSSSlot *slot){    CK_RV ckrv;    PRStatus nssrv;    /* XXX */    nssSession *session;    CK_SLOT_INFO slotInfo;    void *epv;    /* permanent slots are always present */    if (nssSlot_IsPermanent(slot)) {	return PR_TRUE;    }    /* avoid repeated calls to check token status within set interval */    if (within_token_delay_period(slot)) {	return (PRBool)((slot->ckFlags & CKF_TOKEN_PRESENT) != 0);    }    /* First obtain the slot info */#ifdef PURE_STAN_BUILD    epv = nssModule_GetCryptokiEPV(slot->module);#else    epv = slot->epv;#endif    if (!epv) {	return PR_FALSE;    }    ckrv = CKAPI(epv)->C_GetSlotInfo(slot->slotID, &slotInfo);    if (ckrv != CKR_OK) {	slot->token->base.name[0] = 0; /* XXX */	return PR_FALSE;    }    slot->ckFlags = slotInfo.flags;    /* check for the presence of the token */    if ((slot->ckFlags & CKF_TOKEN_PRESENT) == 0) {	if (!slot->token) {	    /* token was ne'er present */	    return PR_FALSE;	}	session = nssToken_GetDefaultSession(slot->token);	nssSession_EnterMonitor(session);	/* token is not present */	if (session->handle != CK_INVALID_SESSION) {	    /* session is valid, close and invalidate it */	    CKAPI(epv)->C_CloseSession(session->handle);	    session->handle = CK_INVALID_SESSION;	}	nssSession_ExitMonitor(session);#ifdef NSS_3_4_CODE	if (slot->token->base.name[0] != 0) {	    /* notify the high-level cache that the token is removed */	    slot->token->base.name[0] = 0; /* XXX */	    nssToken_NotifyCertsNotVisible(slot->token);	}#endif	slot->token->base.name[0] = 0; /* XXX */	/* clear the token cache */	nssToken_Remove(slot->token);	return PR_FALSE;#ifdef PURE_STAN_CODE    } else if (!slot->token) {	/* token was not present at boot time, is now */	slot->token = nssToken_Create(slot->slotID, slot);	return (slot->token != NULL);#endif    }    /* token is present, use the session info to determine if the card     * has been removed and reinserted.     */    session = nssToken_GetDefaultSession(slot->token);    nssSession_EnterMonitor(session);    if (session->handle != CK_INVALID_SESSION) {	CK_SESSION_INFO sessionInfo;	ckrv = CKAPI(epv)->C_GetSessionInfo(session->handle, &sessionInfo);	if (ckrv != CKR_OK) {	    /* session is screwy, close and invalidate it */	    CKAPI(epv)->C_CloseSession(session->handle);	    session->handle = CK_INVALID_SESSION;	}    }    nssSession_ExitMonitor(session);    /* token not removed, finished */    if (session->handle != CK_INVALID_SESSION) {	return PR_TRUE;    } else {	/* the token has been removed, and reinserted, invalidate all the old	 * information we had on this token */#ifdef NSS_3_4_CODE	nssToken_NotifyCertsNotVisible(slot->token);#endif /* NSS_3_4_CODE */	nssToken_Remove(slot->token);	/* token has been removed, need to refresh with new session */	nssrv = nssSlot_Refresh(slot);	if (nssrv != PR_SUCCESS) {	    slot->token->base.name[0] = 0; /* XXX */	    return PR_FALSE;	}	return PR_TRUE;    }}