nsresult
CopyListener::OnStopCopy(nsresult aStatus)
{
  if (NS_SUCCEEDED(aStatus))
  {
#ifdef NS_DEBUG
    printf("CopyListener: SUCCESSFUL ON THE COPY OPERATION!\n");
#endif
  }
  else
  {
#ifdef NS_DEBUG
    printf("CopyListener: COPY OPERATION FAILED!\n");
#endif
  }

  if (mCopyInProgress)
  {
      PR_CEnterMonitor(this);
      PR_CNotifyAll(this);
      mCopyInProgress = false;
      PR_CExitMonitor(this);
  }
  if (mComposeAndSend)
    mComposeAndSend->NotifyListenerOnStopCopy(aStatus);

  return NS_OK;
}
 /* void OnStopSending (in string aMsgID, in nsresult aStatus, in wstring aMsg, in nsIFileSpec returnFileSpec); */
 NS_IMETHOD OnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
                        nsIFile *returnFile) {
     PR_CEnterMonitor(this);
     PR_CNotifyAll(this);
     m_done = PR_TRUE;
     PR_CExitMonitor(this);
     return NS_OK ;
 }
static NSFCStatus
_NSFC_ReleaseEntry(NSFCCache cache, NSFCEntryImpl *nep, PRBool *destroyed)
{
    NSFCStatus rfc = NSFC_OK;

    PR_ASSERT(nep);

    if (destroyed)
        *destroyed = PR_FALSE;

    if (nep != NULL) {
        PR_ASSERT(nep->refcnt != 0);

        /* Lock nep's bucket */
        PRUint32 bucket = nep->hash % cache->hsize;
        NSFC_ACQUIREBUCKET(cache, bucket);

        /*
         * If the entry is marked for delete, and the use
         * count is decremented to zero, the entry can be
         * deleted.
         */
        if (--nep->refcnt == 0) {

            PR_ASSERT(nep->fWriting == 0);

            if (nep->fDelete) {
                NSFC_DestroyEntry(cache, nep);
                if (destroyed)
                    *destroyed = PR_TRUE;
            }
        }
        else if ((nep->flags & NSFCENTRY_WAITING) &&
                 (nep->refcnt == 1)) {
            /* required to notify someone who is waiting to 
               set private data */
            PR_CEnterMonitor((void*)nep);
            PR_CNotifyAll((void*)nep);
            PR_CExitMonitor((void*)nep);
        }

        /* Unlock nep's bucket */
        NSFC_RELEASEBUCKET(cache, bucket);

        rfc = NSFC_OK;
    }

    return rfc;
}
Beispiel #4
0
JSJ_InitStandalone()
{
    static int initialized = -1;

    if (initialized == 1)
        return;

    PR_CEnterMonitor(&initialized);
    switch (initialized) {
      case -1:
	/* we're first */
	initialized = 0; /* in progress */
	PR_CExitMonitor(&initialized);

	/* do it */
        sajsj_InitLocked();

	PR_CEnterMonitor(&initialized);
	initialized = 1;
	PR_CNotifyAll(&initialized);
	break;
      case 0:
	/* in progress */
	PR_CWait(&initialized, WAIT_FOREVER);
	break;
      case 1:
	/* happened since the last check */
	break;
    }
    PR_CExitMonitor(&initialized);

    if (!jsjiTask)
	return;  /* FIXME fail loudly! */

    return;
}