本文整理汇总了C++中EncFS_Context::isMounted方法的典型用法代码示例。如果您正苦于以下问题:C++ EncFS_Context::isMounted方法的具体用法?C++ EncFS_Context::isMounted怎么用?C++ EncFS_Context::isMounted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EncFS_Context
的用法示例。
在下文中一共展示了EncFS_Context::isMounted方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: idleMonitor
static
void * idleMonitor(void *_arg)
{
EncFS_Context *ctx = (EncFS_Context*)_arg;
shared_ptr<EncFS_Args> arg = ctx->args;
const int timeoutCycles = 60 * arg->idleTimeout / ActivityCheckInterval;
int idleCycles = 0;
ctx->wakeupMutex.lock();
while(ctx->running)
{
int usage = ctx->getAndResetUsageCounter();
if(usage == 0 && ctx->isMounted())
++idleCycles;
else
idleCycles = 0;
if(idleCycles >= timeoutCycles)
{
int openCount = ctx->openFileCount();
if( openCount == 0 && unmountFS( ctx ) )
{
#ifdef CMAKE_USE_PTHREADS_INIT
// wait for main thread to wake us up
pthread_cond_wait( &ctx->wakeupCond, &ctx->wakeupMutex._mutex );
#endif
break;
}
VLOG(1) << "num open files: " << openCount;
}
VLOG(1) << "idle cycle count: " << idleCycles
<< ", timeout after " << timeoutCycles;
struct timeval currentTime;
gettimeofday( ¤tTime, 0 );
struct timespec wakeupTime;
wakeupTime.tv_sec = currentTime.tv_sec + ActivityCheckInterval;
wakeupTime.tv_nsec = currentTime.tv_usec * 1000;
#ifdef CMAKE_USE_PTHREADS_INIT
pthread_cond_timedwait( &ctx->wakeupCond,
&ctx->wakeupMutex._mutex, &wakeupTime );
#endif
}
ctx->wakeupMutex.unlock();
VLOG(1) << "Idle monitoring thread exiting";
return 0;
}
示例2: idleMonitor
static
void * idleMonitor(void *_arg)
{
EncFS_Context *ctx = (EncFS_Context*)_arg;
shared_ptr<EncFS_Args> arg = ctx->args;
const int timeoutCycles = 60 * arg->idleTimeout / ActivityCheckInterval;
int idleCycles = 0;
pthread_mutex_lock( &ctx->wakeupMutex );
while(ctx->running)
{
int usage = ctx->getAndResetUsageCounter();
if(usage == 0 && ctx->isMounted())
++idleCycles;
else
idleCycles = 0;
if(idleCycles >= timeoutCycles)
{
int openCount = ctx->openFileCount();
if( openCount == 0 && unmountFS( ctx ) )
{
// wait for main thread to wake us up
pthread_cond_wait( &ctx->wakeupCond, &ctx->wakeupMutex );
break;
}
rDebug("num open files: %i", openCount );
}
rDebug("idle cycle count: %i, timeout after %i", idleCycles,
timeoutCycles);
struct timeval currentTime;
gettimeofday( ¤tTime, 0 );
struct timespec wakeupTime;
wakeupTime.tv_sec = currentTime.tv_sec + ActivityCheckInterval;
wakeupTime.tv_nsec = currentTime.tv_usec * 1000;
pthread_cond_timedwait( &ctx->wakeupCond,
&ctx->wakeupMutex, &wakeupTime );
}
pthread_mutex_unlock( &ctx->wakeupMutex );
rDebug("Idle monitoring thread exiting");
return 0;
}