コード例 #1
0
bool ThreadedFileWorker::FlushDirCache( const CString &sPath )
{
	/* FlushDirCache() is often called globally, on all drivers, which means it's called with
	 * no timeout.  Temporarily enable a timeout if needed. */
	bool bTimeoutEnabled = TimeoutEnabled();
	if( !bTimeoutEnabled )
		SetTimeout(1);

	if( m_pChildDriver == NULL )
		return false;

	/* If we're currently in a timed-out state, fail. */
	if( IsTimedOut() )
		return false;

	m_sRequestPath = sPath;

	/* Kick off the worker thread, and wait for it to finish. */
	if( !DoRequest(REQ_FLUSH_DIR_CACHE) )
	{
		if( !bTimeoutEnabled )
			SetTimeout(-1);

		LOG->Trace( "FlushDirCache(%s) timed out", sPath.c_str() );
		return false;
	}

	if( !bTimeoutEnabled )
		SetTimeout(-1);

	return true;
}
コード例 #2
0
bool ThreadedMemoryCardWorker::Unmount( const UsbStorageDevice *pDevice )
{
	ASSERT( TimeoutEnabled() );

	// If we're currently in a timed-out state, fail.
	if( IsTimedOut() )
		return false;

	m_RequestDevice = *pDevice;
	if( !DoRequest(REQ_UNMOUNT) )
		return false;

	return true;
}