本文整理汇总了C++中PR_APPEND_LINK函数的典型用法代码示例。如果您正苦于以下问题:C++ PR_APPEND_LINK函数的具体用法?C++ PR_APPEND_LINK怎么用?C++ PR_APPEND_LINK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PR_APPEND_LINK函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PR_CreateThreadPool
PR_CreateThreadPool(PRInt32 initial_threads, PRInt32 max_threads,
PRUint32 stacksize)
{
PRThreadPool *tp;
PRThread *thr;
int i;
wthread *wthrp;
tp = alloc_threadpool();
if (NULL == tp)
return NULL;
tp->init_threads = initial_threads;
tp->max_threads = max_threads;
tp->stacksize = stacksize;
PR_INIT_CLIST(&tp->jobq.list);
PR_INIT_CLIST(&tp->ioq.list);
PR_INIT_CLIST(&tp->timerq.list);
PR_INIT_CLIST(&tp->jobq.wthreads);
PR_INIT_CLIST(&tp->ioq.wthreads);
PR_INIT_CLIST(&tp->timerq.wthreads);
tp->shutdown = PR_FALSE;
PR_Lock(tp->jobq.lock);
for(i=0; i < initial_threads; ++i) {
thr = PR_CreateThread(PR_USER_THREAD, wstart,
tp, PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD, PR_JOINABLE_THREAD,stacksize);
PR_ASSERT(thr);
wthrp = PR_NEWZAP(wthread);
PR_ASSERT(wthrp);
wthrp->thread = thr;
PR_APPEND_LINK(&wthrp->links, &tp->jobq.wthreads);
}
tp->current_threads = initial_threads;
thr = PR_CreateThread(PR_USER_THREAD, io_wstart,
tp, PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD,PR_JOINABLE_THREAD,stacksize);
PR_ASSERT(thr);
wthrp = PR_NEWZAP(wthread);
PR_ASSERT(wthrp);
wthrp->thread = thr;
PR_APPEND_LINK(&wthrp->links, &tp->ioq.wthreads);
thr = PR_CreateThread(PR_USER_THREAD, timer_wstart,
tp, PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD,PR_JOINABLE_THREAD,stacksize);
PR_ASSERT(thr);
wthrp = PR_NEWZAP(wthread);
PR_ASSERT(wthrp);
wthrp->thread = thr;
PR_APPEND_LINK(&wthrp->links, &tp->timerq.wthreads);
PR_Unlock(tp->jobq.lock);
return tp;
}
开发者ID:Akesure,项目名称:jxcore,代码行数:58,代码来源:prtpool.c
示例2: add_to_jobq
/*
* add a job to the work queue
*/
static void
add_to_jobq(PRThreadPool *tp, PRJob *jobp)
{
/*
* add to jobq
*/
#ifdef OPT_WINNT
PR_Lock(tp->jobq.lock);
tp->jobq.cnt++;
PR_Unlock(tp->jobq.lock);
/*
* notify worker thread(s)
*/
PostQueuedCompletionStatus(tp->jobq.nt_completion_port, 0,
FALSE, &jobp->nt_notifier.overlapped);
#else
PR_Lock(tp->jobq.lock);
PR_APPEND_LINK(&jobp->links,&tp->jobq.list);
tp->jobq.cnt++;
if ((tp->idle_threads < tp->jobq.cnt) &&
(tp->current_threads < tp->max_threads)) {
wthread *wthrp;
/*
* increment thread count and unlock the jobq lock
*/
tp->current_threads++;
PR_Unlock(tp->jobq.lock);
/* create new worker thread */
wthrp = PR_NEWZAP(wthread);
if (wthrp) {
wthrp->thread = PR_CreateThread(PR_USER_THREAD, wstart,
tp, PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD,PR_JOINABLE_THREAD,tp->stacksize);
if (NULL == wthrp->thread) {
PR_DELETE(wthrp); /* this sets wthrp to NULL */
}
}
PR_Lock(tp->jobq.lock);
if (NULL == wthrp) {
tp->current_threads--;
} else {
PR_APPEND_LINK(&wthrp->links, &tp->jobq.wthreads);
}
}
/*
* wakeup a worker thread
*/
PR_NotifyCondVar(tp->jobq.cv);
PR_Unlock(tp->jobq.lock);
#endif
}
开发者ID:Akesure,项目名称:jxcore,代码行数:54,代码来源:prtpool.c
示例3: LOG
NS_IMETHODIMP
nsSocketTransportService::PostEvent(PLEvent *event)
{
LOG(("nsSocketTransportService::PostEvent [event=%p]\n", event));
NS_ASSERTION(event, "null event");
nsAutoLock lock(mEventQLock);
if (!mInitialized) {
// Allow socket detach handlers to post events
if (!mShuttingDown || (PR_GetCurrentThread() != gSocketThread)) {
NS_WARN_IF_FALSE(PR_GetCurrentThread() != gSocketThread,
"Rejecting event posted to uninitialized sts");
return NS_ERROR_OFFLINE;
}
}
PR_APPEND_LINK(&event->link, &mEventQ);
if (mThreadEvent)
PR_SetPollableEvent(mThreadEvent);
// else wait for Poll timeout
return NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:25,代码来源:nsSocketTransportService2.cpp
示例4: Unlock
nsProfileLock& nsProfileLock::operator=(nsProfileLock& rhs)
{
Unlock();
mHaveLock = rhs.mHaveLock;
rhs.mHaveLock = false;
#if defined (XP_WIN)
mLockFileHandle = rhs.mLockFileHandle;
rhs.mLockFileHandle = INVALID_HANDLE_VALUE;
#elif defined (XP_OS2)
mLockFileHandle = rhs.mLockFileHandle;
rhs.mLockFileHandle = -1;
#elif defined (XP_UNIX)
mLockFileDesc = rhs.mLockFileDesc;
rhs.mLockFileDesc = -1;
mPidLockFileName = rhs.mPidLockFileName;
rhs.mPidLockFileName = nullptr;
if (mPidLockFileName)
{
// rhs had a symlink lock, therefore it was on the list.
PR_REMOVE_LINK(&rhs);
PR_APPEND_LINK(this, &mPidLockList);
}
#endif
return *this;
}
开发者ID:at13,项目名称:mozilla-central,代码行数:28,代码来源:nsProfileLock.cpp
示例5: NS_ENSURE_STATE
nsresult
nsPACMan::AsyncGetProxyForURI(nsIURI *uri, nsPACManCallback *callback)
{
NS_ENSURE_STATE(!mShutdown);
MaybeReloadPAC();
PendingPACQuery *query = new PendingPACQuery(this, uri, callback);
if (!query)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(query);
PR_APPEND_LINK(query, &mPendingQ);
// If we're waiting for the PAC file to load, then delay starting the query.
// See OnStreamComplete. However, if this is the PAC URI then query right
// away since we know the result will be DIRECT. We could shortcut some code
// in this case by issuing the callback directly from here, but that would
// require extra code, so we just go through the usual async code path.
int isPACURI = IsPACURI(uri);
if (IsLoading() && !isPACURI)
return NS_OK;
nsresult rv = query->Start(isPACURI ? 0 : nsIDNSService::RESOLVE_SPECULATE);
if (rv == NS_ERROR_DNS_LOOKUP_QUEUE_FULL && !isPACURI) {
query->OnLookupComplete(NULL, NULL, NS_OK);
rv = NS_OK;
} else if (NS_FAILED(rv)) {
NS_WARNING("failed to start PAC query");
PR_REMOVE_LINK(query);
NS_RELEASE(query);
}
return rv;
}
开发者ID:Anachid,项目名称:mozilla-central,代码行数:35,代码来源:nsPACMan.cpp
示例6: NS_ASSERTION
nsresult
nsMemoryCacheDevice::BindEntry(nsCacheEntry * entry)
{
if (!entry->IsDoomed()) {
NS_ASSERTION(PR_CLIST_IS_EMPTY(entry),"entry is already on a list!");
// append entry to the eviction list
PR_APPEND_LINK(entry, &mEvictionList[EvictionList(entry, 0)]);
// add entry to hashtable of mem cache entries
nsresult rv = mMemCacheEntries.AddEntry(entry);
if (NS_FAILED(rv)) {
PR_REMOVE_AND_INIT_LINK(entry);
return rv;
}
// add size of entry to memory totals
++mEntryCount;
if (mMaxEntryCount < mEntryCount) mMaxEntryCount = mEntryCount;
mTotalSize += entry->DataSize();
EvictEntriesIfNecessary();
}
return NS_OK;
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:26,代码来源:nsMemoryCacheDevice.cpp
示例7: OrderLoop
/**
* Called from PL_HashTableEnumerateEntries
* A pointer to a PRCList (circular linked list) is passed in.
* Once enumeration is complete, the PRCList will contain a lexically
* ordered list of a copy of the keys in the hash.
* The caller needs to free the copies
*/
static PRIntn OrderLoop(PLHashEntry *he, PRIntn index, void *arg)
{
PRCList *qp = (PRCList *)arg;
OrderedEntry_t *entry;
if (he != NULL) {
entry = (OrderedEntry_t *) PR_Malloc(sizeof(OrderedEntry_t));
entry->key = PL_strdup((char *) he->key);
if (index ==0) {
PR_APPEND_LINK((PRCList *)entry, qp);
return HT_ENUMERATE_NEXT;
}
PRCList *head = PR_LIST_HEAD(qp);
PRCList *next;
while (head != qp) {
OrderedEntry_t *current = (OrderedEntry_t *) head;
if (strcmp((char *) he->key, (char *) current->key) <=0)
break;
next = PR_NEXT_LINK(head);
head = next;
}
PR_INSERT_BEFORE((PRCList*) entry, head);
return HT_ENUMERATE_NEXT;
} else {
return HT_ENUMERATE_STOP;
}
}
开发者ID:encukou,项目名称:pki,代码行数:34,代码来源:ConfigStore.cpp
示例8: jobLoop
int
jobLoop(PRFileDesc *a, PRFileDesc *b, int c)
{
PRCList *myLink = 0;
JOB *myJob;
PZ_Lock(qLock);
do {
myLink = 0;
while (PR_CLIST_IS_EMPTY(&jobQ) && !stopping) {
PZ_WaitCondVar(jobQNotEmptyCv, PR_INTERVAL_NO_TIMEOUT);
}
if (!PR_CLIST_IS_EMPTY(&jobQ)) {
myLink = PR_LIST_HEAD(&jobQ);
PR_REMOVE_AND_INIT_LINK(myLink);
}
PZ_Unlock(qLock);
myJob = (JOB *)myLink;
/* myJob will be null when stopping is true and jobQ is empty */
if (!myJob)
break;
handle_connection(myJob->tcp_sock, myJob->model_sock,
myJob->requestCert);
PZ_Lock(qLock);
PR_APPEND_LINK(myLink, &freeJobs);
PZ_NotifyCondVar(freeListNotEmptyCv);
} while (PR_TRUE);
return 0;
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:29,代码来源:httpserv.c
示例9: SSLExp_InstallExtensionHooks
SECStatus
SSLExp_InstallExtensionHooks(PRFileDesc *fd, PRUint16 extension,
SSLExtensionWriter writer, void *writerArg,
SSLExtensionHandler handler, void *handlerArg)
{
sslSocket *ss = ssl_FindSocket(fd);
PRCList *cursor;
sslCustomExtensionHooks *hook;
if (!ss) {
return SECFailure; /* Code already set. */
}
/* Need to specify both or neither, but not just one. */
if ((writer && !handler) || (!writer && handler)) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
if (ssl_GetExtensionSupport(extension) == ssl_ext_native_only) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
if (ss->firstHsDone || ((ss->ssl3.hs.ws != idle_handshake) &&
(ss->ssl3.hs.ws != wait_client_hello))) {
PORT_SetError(PR_INVALID_STATE_ERROR);
return SECFailure;
}
/* Remove any old handler. */
for (cursor = PR_NEXT_LINK(&ss->extensionHooks);
cursor != &ss->extensionHooks;
cursor = PR_NEXT_LINK(cursor)) {
hook = (sslCustomExtensionHooks *)cursor;
if (hook->type == extension) {
PR_REMOVE_LINK(&hook->link);
PORT_Free(hook);
break;
}
}
if (!writer && !handler) {
return SECSuccess;
}
hook = PORT_ZNew(sslCustomExtensionHooks);
if (!hook) {
return SECFailure; /* This removed the old one, oh well. */
}
hook->type = extension;
hook->writer = writer;
hook->writerArg = writerArg;
hook->handler = handler;
hook->handlerArg = handlerArg;
PR_APPEND_LINK(&hook->link, &ss->extensionHooks);
return SECSuccess;
}
开发者ID:franziskuskiefer,项目名称:nss,代码行数:59,代码来源:ssl3ext.c
示例10: MarkInitialized
nsresult
nsCacheEntry::RequestAccess(nsCacheRequest * request, nsCacheAccessMode *accessGranted)
{
nsresult rv = NS_OK;
if (!IsInitialized()) {
// brand new, unbound entry
request->mKey = nsnull; // steal ownership of the key string
if (request->IsStreamBased()) MarkStreamBased();
MarkInitialized();
*accessGranted = request->AccessRequested() & nsICache::ACCESS_WRITE;
NS_ASSERTION(*accessGranted, "new cache entry for READ-ONLY request");
PR_APPEND_LINK(request, &mRequestQ);
return rv;
}
if (IsDoomed()) return NS_ERROR_CACHE_ENTRY_DOOMED;
if (IsStreamData() != request->IsStreamBased()) {
*accessGranted = nsICache::ACCESS_NONE;
return request->IsStreamBased() ?
NS_ERROR_CACHE_DATA_IS_NOT_STREAM : NS_ERROR_CACHE_DATA_IS_STREAM;
}
if (PR_CLIST_IS_EMPTY(&mDescriptorQ)) {
// 1st descriptor for existing bound entry
*accessGranted = request->AccessRequested();
if (*accessGranted & nsICache::ACCESS_WRITE) {
MarkInvalid();
} else {
MarkValid();
}
} else {
// nth request for existing, bound entry
*accessGranted = request->AccessRequested() & ~nsICache::ACCESS_WRITE;
if (!IsValid())
rv = NS_ERROR_CACHE_WAIT_FOR_VALIDATION;
}
PR_APPEND_LINK(request,&mRequestQ);
return rv;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:43,代码来源:nsCacheEntry.cpp
示例11: ssl3_ParseExtensions
/* Go through hello extensions in |b| and deserialize
* them into the list in |ss->ssl3.hs.remoteExtensions|.
* The only checking we do in this point is for duplicates.
*
* IMPORTANT: This list just contains pointers to the incoming
* buffer so they can only be used during ClientHello processing.
*/
SECStatus
ssl3_ParseExtensions(sslSocket *ss, PRUint8 **b, PRUint32 *length)
{
/* Clean out the extensions list. */
ssl3_DestroyRemoteExtensions(&ss->ssl3.hs.remoteExtensions);
while (*length) {
SECStatus rv;
PRUint32 extension_type;
SECItem extension_data = { siBuffer, NULL, 0 };
TLSExtension *extension;
PRCList *cursor;
/* Get the extension's type field */
rv = ssl3_ConsumeHandshakeNumber(ss, &extension_type, 2, b, length);
if (rv != SECSuccess) {
return SECFailure; /* alert already sent */
}
/* Check whether an extension has been sent multiple times. */
for (cursor = PR_NEXT_LINK(&ss->ssl3.hs.remoteExtensions);
cursor != &ss->ssl3.hs.remoteExtensions;
cursor = PR_NEXT_LINK(cursor)) {
if (((TLSExtension *)cursor)->type == extension_type) {
(void)SSL3_SendAlert(ss, alert_fatal, illegal_parameter);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_EXTENSION);
return SECFailure;
}
}
/* Get the data for this extension, so we can pass it or skip it. */
rv = ssl3_ConsumeHandshakeVariable(ss, &extension_data, 2, b, length);
if (rv != SECSuccess) {
return rv; /* alert already sent */
}
SSL_TRC(10, ("%d: SSL3[%d]: parsed extension %d len=%u",
SSL_GETPID(), ss->fd, extension_type, extension_data.len));
extension = PORT_ZNew(TLSExtension);
if (!extension) {
return SECFailure;
}
extension->type = (PRUint16)extension_type;
extension->data = extension_data;
PR_APPEND_LINK(&extension->link, &ss->ssl3.hs.remoteExtensions);
}
return SECSuccess;
}
开发者ID:franziskuskiefer,项目名称:nss,代码行数:58,代码来源:ssl3ext.c
示例12: PR_REMOVE_AND_INIT_LINK
nsCacheEntry *
nsMemoryCacheDevice::FindEntry(nsCString * key, bool *collision)
{
mozilla::Telemetry::AutoTimer<mozilla::Telemetry::CACHE_MEMORY_SEARCH_2> timer;
nsCacheEntry * entry = mMemCacheEntries.GetEntry(key);
if (!entry) return nullptr;
// move entry to the tail of an eviction list
PR_REMOVE_AND_INIT_LINK(entry);
PR_APPEND_LINK(entry, &mEvictionList[EvictionList(entry, 0)]);
mInactiveSize -= entry->DataSize();
return entry;
}
开发者ID:Andrel322,项目名称:gecko-dev,代码行数:15,代码来源:nsMemoryCacheDevice.cpp
示例13: PR_IMPLEMENT
/*
** Test and then lock the lock if it's not already locked by some other
** thread. Return PR_FALSE if some other thread owned the lock at the
** time of the call.
*/
PR_IMPLEMENT(PRBool) PR_TestAndLock(PRLock *lock)
{
PRThread *me = _PR_MD_CURRENT_THREAD();
PRBool rv = PR_FALSE;
PRIntn is;
#ifdef _PR_GLOBAL_THREADS_ONLY
is = _PR_MD_TEST_AND_LOCK(&lock->ilock);
if (is == 0) {
lock->owner = me;
return PR_TRUE;
}
return PR_FALSE;
#else /* _PR_GLOBAL_THREADS_ONLY */
#ifndef _PR_LOCAL_THREADS_ONLY
if (_native_threads_only) {
is = _PR_MD_TEST_AND_LOCK(&lock->ilock);
if (is == 0) {
lock->owner = me;
return PR_TRUE;
}
return PR_FALSE;
}
#endif
if (!_PR_IS_NATIVE_THREAD(me))
_PR_INTSOFF(is);
_PR_LOCK_LOCK(lock);
if (lock->owner == 0) {
/* Just got the lock */
lock->owner = me;
lock->priority = me->priority;
/* Add the granted lock to this owning thread's lock list */
PR_APPEND_LINK(&lock->links, &me->lockList);
rv = PR_TRUE;
}
_PR_LOCK_UNLOCK(lock);
if (!_PR_IS_NATIVE_THREAD(me))
_PR_INTSON(is);
return rv;
#endif /* _PR_GLOBAL_THREADS_ONLY */
}
开发者ID:julianpistorius,项目名称:gp-revolution-gecko,代码行数:50,代码来源:prulock.c
示例14: setupJobs
SECStatus
setupJobs(int maxJobs)
{
int i;
jobTable = (JOB *)PR_Calloc(maxJobs, sizeof(JOB));
if (!jobTable)
return SECFailure;
PR_INIT_CLIST(&jobQ);
PR_INIT_CLIST(&freeJobs);
for (i = 0; i < maxJobs; ++i) {
JOB *pJob = jobTable + i;
PR_APPEND_LINK(&pJob->link, &freeJobs);
}
return SECSuccess;
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:18,代码来源:httpserv.c
示例15: _PR_MD_CLEAN_THREAD
void
_PR_MD_CLEAN_THREAD(PRThread *thread)
{
BOOL rv;
if (thread->md.acceptex_buf) {
PR_DELETE(thread->md.acceptex_buf);
}
if (thread->md.xmit_bufs) {
PR_DELETE(thread->md.xmit_bufs);
}
if (thread->md.blocked_sema) {
rv = CloseHandle(thread->md.blocked_sema);
PR_ASSERT(rv);
thread->md.blocked_sema = 0;
}
if (_native_threads_only) {
if (thread->md.thr_event) {
rv = CloseHandle(thread->md.thr_event);
PR_ASSERT(rv);
thread->md.thr_event = 0;
}
}
if (thread->md.handle) {
rv = CloseHandle(thread->md.handle);
PR_ASSERT(rv);
thread->md.handle = 0;
}
/* Don't call DeleteFiber on current fiber or we'll kill the whole thread.
* Don't call free(thread) until we've switched off the thread.
* So put this fiber (or thread) on a list to be deleted by the idle
* fiber next time we have a chance.
*/
if (!(thread->flags & (_PR_ATTACHED|_PR_GLOBAL_SCOPE))) {
_MD_LOCK(&_nt_idleLock);
_nt_idleCount++;
PR_APPEND_LINK(&thread->links, &_nt_idleList);
_MD_UNLOCK(&_nt_idleLock);
}
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:44,代码来源:ntthread.c
示例16: tls13_HandleKeyShareEntry
static SECStatus
tls13_HandleKeyShareEntry(const sslSocket *ss, TLSExtensionData *xtnData, SECItem *data)
{
SECStatus rv;
PRUint32 group;
const sslNamedGroupDef *groupDef;
TLS13KeyShareEntry *ks = NULL;
SECItem share = { siBuffer, NULL, 0 };
rv = ssl3_ExtConsumeHandshakeNumber(ss, &group, 2, &data->data, &data->len);
if (rv != SECSuccess) {
PORT_SetError(SSL_ERROR_RX_MALFORMED_KEY_SHARE);
goto loser;
}
groupDef = ssl_LookupNamedGroup(group);
rv = ssl3_ExtConsumeHandshakeVariable(ss, &share, 2, &data->data,
&data->len);
if (rv != SECSuccess) {
goto loser;
}
/* If the group is disabled, continue. */
if (!groupDef) {
return SECSuccess;
}
ks = PORT_ZNew(TLS13KeyShareEntry);
if (!ks)
goto loser;
ks->group = groupDef;
rv = SECITEM_CopyItem(NULL, &ks->key_exchange, &share);
if (rv != SECSuccess)
goto loser;
PR_APPEND_LINK(&ks->link, &xtnData->remoteKeyShares);
return SECSuccess;
loser:
if (ks)
tls13_DestroyKeyShareEntry(ks);
return SECFailure;
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:42,代码来源:tls13exthandle.c
示例17: ssl_SetSignedTimestampsInSlot
static SECStatus
ssl_SetSignedTimestampsInSlot(sslSocket *ss, SSLAuthType authType,
const SECItem *scts)
{
sslServerCert *sc;
SECStatus rv;
sc = ssl_FindOrMakeCertType(ss, authType);
if (!sc) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
return SECFailure;
}
rv = ssl_PopulateSignedCertTimestamps(sc, scts);
if (rv == SECSuccess) {
PR_APPEND_LINK(&sc->link, &ss->serverCerts);
} else {
ssl_FreeServerCert(sc);
}
return rv;
}
开发者ID:lazyparser,项目名称:gecko-dev,代码行数:20,代码来源:sslcert.c
示例18: LOG
NS_IMETHODIMP
nsIOThreadPool::PostEvent(PLEvent *event)
{
LOG(("nsIOThreadPool::PostEvent [event=%p]\n", event));
nsAutoLock lock(mLock);
// if we are shutting down, then prevent additional events from being
// added to the queue...
if (mShutdown)
return NS_ERROR_UNEXPECTED;
nsresult rv = NS_OK;
PR_APPEND_LINK(&event->link, &mEventQ);
// now, look for an available idle thread...
if (mNumIdleThreads)
PR_NotifyCondVar(mIdleThreadCV); // wake up an idle thread
// or, try to create a new thread unless we have reached our maximum...
else if (mNumThreads < MAX_THREADS) {
NS_ADDREF_THIS(); // the thread owns a reference to us
mNumThreads++;
PRThread *thread = PR_CreateThread(PR_USER_THREAD,
ThreadFunc,
this,
PR_PRIORITY_NORMAL,
PR_GLOBAL_THREAD,
PR_UNJOINABLE_THREAD,
0);
if (!thread) {
NS_RELEASE_THIS();
mNumThreads--;
rv = NS_ERROR_OUT_OF_MEMORY;
}
}
// else, we expect one of the active threads to process the event queue.
return rv;
}
开发者ID:lofter2011,项目名称:Icefox,代码行数:41,代码来源:nsIOThreadPool.cpp
示例19: NS_ENSURE_ARG_POINTER
nsresult
nsCacheEntry::CreateDescriptor(nsCacheRequest * request,
nsCacheAccessMode accessGranted,
nsICacheEntryDescriptor ** result)
{
NS_ENSURE_ARG_POINTER(request && result);
nsCacheEntryDescriptor * descriptor =
new nsCacheEntryDescriptor(this, accessGranted);
// XXX check request is on q
PR_REMOVE_AND_INIT_LINK(request); // remove request regardless of success
if (descriptor == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
PR_APPEND_LINK(descriptor, &mDescriptorQ);
NS_ADDREF(*result = descriptor);
return NS_OK;
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:21,代码来源:nsCacheEntry.cpp
示例20: ssl_AddCertAndKeyByAuthType
static SECStatus
ssl_AddCertAndKeyByAuthType(sslSocket *ss, SSLAuthType authType,
CERTCertificate *cert,
const CERTCertificateList *certChainOpt,
sslKeyPair *keyPair)
{
sslServerCert *sc;
SECStatus rv;
if (!ssl_CertSuitableForAuthType(cert, authType)) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
sc = ssl_FindOrMakeCertType(ss, authType);
if (!sc) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
return SECFailure;
}
rv = ssl_PopulateKeyPair(sc, keyPair);
if (rv != SECSuccess) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
goto loser;
}
/* Now that we have a key pair, update the details of the slot. Many of the
* legacy functions create a slot with a namedCurve of NULL, which
* makes the slot unusable; this corrects that. */
ssl_PopulateCertType(&sc->certType, authType, cert, keyPair);
rv = ssl_PopulateServerCert(sc, cert, certChainOpt);
if (rv != SECSuccess) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
goto loser;
}
PR_APPEND_LINK(&sc->link, &ss->serverCerts);
return ssl_OneTimeCertSetup(ss, sc);
loser:
ssl_FreeServerCert(sc);
return SECFailure;
}
开发者ID:lazyparser,项目名称:gecko-dev,代码行数:39,代码来源:sslcert.c
注:本文中的PR_APPEND_LINK函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论