本文整理汇总了C++中PR_ExitMonitor函数的典型用法代码示例。如果您正苦于以下问题:C++ PR_ExitMonitor函数的具体用法?C++ PR_ExitMonitor怎么用?C++ PR_ExitMonitor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PR_ExitMonitor函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PR_ExitMonitor
nsresult
nsTransactionManager::Unlock()
{
if (mMonitor)
PR_ExitMonitor(mMonitor);
return NS_OK;
}
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:8,代码来源:nsTransactionManager.cpp
示例2: Release
void
Monitor::Exit()
{
if (0 == --mEntryCount)
Release(); // protected by mMonitor
PRStatus status = PR_ExitMonitor(mMonitor);
NS_ASSERTION(PR_SUCCESS == status, "bad Monitor::Exit()");
}
开发者ID:MozillaOnline,项目名称:gecko-dev,代码行数:8,代码来源:BlockingResourceBase.cpp
示例3: T1Mon
static void T1Mon(void)
{
PRStatus rv;
PRThread *t2, *t3;
PR_fprintf(err, "\n**********************************\n");
PR_fprintf(err, " MONITORS\n");
PR_fprintf(err, "**********************************\n");
sharedM.o1 = PR_NewMonitor();
sharedM.o2 = PR_NewMonitor();
base = PR_IntervalNow();
PR_EnterMonitor(sharedM.o1);
LogNow("T1 waiting 3 seconds on o1", PR_SUCCESS);
rv = PR_Wait(sharedM.o1, PR_SecondsToInterval(3));
if (PR_SUCCESS == rv) LogNow("T1 resuming on o1", rv);
else LogNow("T1 wait on o1 failed", rv);
PR_ExitMonitor(sharedM.o1);
LogNow("T1 creating T2", PR_SUCCESS);
t2 = PR_CreateThread(
PR_USER_THREAD, T2Mon, &sharedM, PR_PRIORITY_NORMAL,
PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
LogNow("T1 creating T3", PR_SUCCESS);
t3 = PR_CreateThread(
PR_USER_THREAD, T3Mon, &sharedM, PR_PRIORITY_NORMAL,
PR_LOCAL_THREAD, PR_JOINABLE_THREAD, 0);
PR_EnterMonitor(sharedM.o2);
LogNow("T1 waiting forever on o2", PR_SUCCESS);
rv = PR_Wait(sharedM.o2, PR_INTERVAL_NO_TIMEOUT);
if (PR_SUCCESS == rv) LogNow("T1 resuming on o2", rv);
else LogNow("T1 wait on o2 failed", rv);
PR_ExitMonitor(sharedM.o2);
(void)PR_JoinThread(t2);
(void)PR_JoinThread(t3);
PR_DestroyMonitor(sharedM.o1);
PR_DestroyMonitor(sharedM.o2);
} /* T1Mon */
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.external,代码行数:45,代码来源:xnotify.c
示例4: PR_EnterMonitor
NS_IMETHODIMP nsIMAPHostSessionList::SetHaveWeEverDiscoveredFoldersForHost(const char *serverKey, bool discovered)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(serverKey);
if (host)
host->fHaveWeEverDiscoveredFolders = discovered;
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
开发者ID:vanto,项目名称:comm-central,代码行数:9,代码来源:nsIMAPHostSessionList.cpp
示例5: Release
void
ReentrantMonitor::Exit()
{
if (--mEntryCount == 0) {
Release(); // protected by mReentrantMonitor
}
PRStatus status = PR_ExitMonitor(mReentrantMonitor);
NS_ASSERTION(PR_SUCCESS == status, "bad ReentrantMonitor::Exit()");
}
开发者ID:chenhequn,项目名称:gecko,代码行数:9,代码来源:BlockingResourceBase.cpp
示例6: PR_EnterMonitor
NS_IMETHODIMP nsIMAPHostSessionList::GetPasswordForHost(const char *serverKey, nsString &result)
{
PR_EnterMonitor(gCachedHostInfoMonitor);
nsIMAPHostInfo *host = FindHost(serverKey);
if (host)
result.AssignWithConversion(host->fCachedPassword);
PR_ExitMonitor(gCachedHostInfoMonitor);
return (host == NULL) ? NS_ERROR_ILLEGAL_VALUE : NS_OK;
}
开发者ID:rn10950,项目名称:RetroZilla,代码行数:9,代码来源:nsIMAPHostSessionList.cpp
示例7: WaitMonitorThread
static void WaitMonitorThread(void *arg)
{
PRIntervalTime timeout = (PRIntervalTime) arg;
PRIntervalTime elapsed;
#if defined(XP_UNIX) || defined(WIN32)
PRInt32 timeout_msecs = PR_IntervalToMilliseconds(timeout);
PRInt32 elapsed_msecs;
#endif
#if defined(XP_UNIX)
struct timeval end_time_tv;
#endif
#if defined(WIN32) && !defined(WINCE)
struct _timeb end_time_tb;
#endif
PRMonitor *mon;
mon = PR_NewMonitor();
if (mon == NULL) {
fprintf(stderr, "PR_NewMonitor failed\n");
exit(1);
}
PR_EnterMonitor(mon);
PR_Wait(mon, timeout);
PR_ExitMonitor(mon);
elapsed = (PRIntervalTime)(PR_IntervalNow() - start_time);
if (elapsed + tolerance < timeout || elapsed > timeout + tolerance) {
fprintf(stderr, "timeout wrong\n");
exit(1);
}
#if defined(XP_UNIX)
gettimeofday(&end_time_tv, NULL);
elapsed_msecs = 1000*(end_time_tv.tv_sec - start_time_tv.tv_sec)
+ (end_time_tv.tv_usec - start_time_tv.tv_usec)/1000;
#endif
#if defined(WIN32)
#if defined(WINCE)
elapsed_msecs = GetTickCount() - start_time_tick;
#else
_ftime(&end_time_tb);
elapsed_msecs = 1000*(end_time_tb.time - start_time_tb.time)
+ (end_time_tb.millitm - start_time_tb.millitm);
#endif
#endif
#if defined(XP_UNIX) || defined(WIN32)
if (elapsed_msecs + tolerance_msecs < timeout_msecs
|| elapsed_msecs > timeout_msecs + tolerance_msecs) {
fprintf(stderr, "timeout wrong\n");
exit(1);
}
#endif
PR_DestroyMonitor(mon);
if (debug_mode) {
fprintf(stderr, "wait monitor thread (scope %d) done\n",
PR_GetThreadScope(PR_GetCurrentThread()));
}
}
开发者ID:Akheon23,项目名称:chromecast-mirrored-source.external,代码行数:56,代码来源:y2ktmo.c
示例8: PR_Now
void aptCoreTrace::Log(eLogLevel eLevel, const char* fmt, ...)
{
static const int nEOL = 2;
if (!mCanLog) return;
if (eLevel < mCoreLogLevel) return;
PRTime curTime = PR_Now();
PRExplodedTime localTime;
PR_ExplodeTime(curTime, PR_LocalTimeParameters, &localTime);
PR_EnterMonitor(mLoggerLock);
PRUint32 nWritten = PR_snprintf(mBuf, mBufSize-nEOL,
"%02d:%02d:%02d %02d/%02d/%04d [%6d] [%s] ", // XXX i18n!
localTime.tm_hour, localTime.tm_min, localTime.tm_sec,
localTime.tm_month+1, localTime.tm_mday, localTime.tm_year,
mPid, gsLogLevel[eLevel]);
va_list arg_ptr;
va_start(arg_ptr, fmt);
PRUint32 nExtra = PR_vsnprintf(mBuf+nWritten, mBufSize-nWritten-nEOL, fmt, arg_ptr);
va_end(arg_ptr);
if (nExtra == (PRUint32) (-1))
{
//failed?
PR_ExitMonitor(mLoggerLock);
return;
}
nWritten += nExtra;
#ifdef _WIN32
mBuf[nWritten++] = '\r';
#endif
mBuf[nWritten++] = '\n';
mLC->WriteLog(mBuf, nWritten);
PR_ExitMonitor(mLoggerLock);
}
开发者ID:aptana,项目名称:Jaxer,代码行数:43,代码来源:aptCoreTrace.cpp
示例9: TryEntry
static void PR_CALLBACK TryEntry(void *arg)
{
PRMonitor *ml = (PRMonitor*)arg;
if (debug_mode) PR_fprintf(std_err, "Reentrant thread created\n");
PR_EnterMonitor(ml);
PR_ASSERT_CURRENT_THREAD_IN_MONITOR(ml);
if (debug_mode) PR_fprintf(std_err, "Reentrant thread acquired monitor\n");
PR_ExitMonitor(ml);
if (debug_mode) PR_fprintf(std_err, "Reentrant thread released monitor\n");
} /* TryEntry */
开发者ID:Akin-Net,项目名称:mozilla-central,代码行数:10,代码来源:lock.c
示例10: JSJ_DetachCurrentThreadFromJava
JSJ_DetachCurrentThreadFromJava(JSJavaThreadState *jsj_env)
{
SystemJavaVM *java_vm;
JNIEnv* jEnv;
JSJavaThreadState *e, **p;
/* Disassociate the current native thread from its corresponding Java thread */
java_vm = jsj_env->jsjava_vm->java_vm;
jEnv = jsj_env->jEnv;
#ifdef JSJ_THREADSAFE
PR_EnterMonitor(thread_list_monitor);
#endif /* JSJ_THREADSAFE */
if (!JSJ_callbacks->detach_current_thread(java_vm, jEnv)) {
#ifdef JSJ_THREADSAFE
PR_ExitMonitor(thread_list_monitor);
#endif /* JSJ_THREADSAFE */
return JS_FALSE;
}
/* Destroy the LiveConnect execution environment passed in */
jsj_ClearPendingJSErrors(jsj_env);
for (p = &thread_list; (e = *p) != NULL; p = &(e->next)) {
if (e == jsj_env) {
*p = jsj_env->next;
break;
}
}
JS_ASSERT(e);
#ifdef JSJ_THREADSAFE
PR_ExitMonitor(thread_list_monitor);
#endif /* JSJ_THREADSAFE */
free(jsj_env);
return JS_TRUE;
}
开发者ID:chemeris,项目名称:sipxecs,代码行数:42,代码来源:jsj.c
注:本文中的PR_ExitMonitor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论