Beispiel #1
0
FileWatcher::FileWatcher( bool useGenericFileWatcher ) :
	mFollowSymlinks(false),
	mOutOfScopeLinks(false)
{
	if ( useGenericFileWatcher )
	{
		efDEBUG( "Using backend: Generic\n" );

		mImpl = new FileWatcherGeneric( this );
	}
	else
	{
		efDEBUG( "Using backend: %s\n", BACKEND_NAME );

		mImpl = new FILEWATCHER_IMPL( this );

		if ( !mImpl->initOK() )
		{
			efSAFE_DELETE( mImpl );

			efDEBUG( "Falled back to backend: %s\n", BACKEND_NAME );

			mImpl = new FileWatcherGeneric( this );
		}
	}
}
FileWatcherGeneric::~FileWatcherGeneric()
{
	mInitOK = false;

	mThread->wait();

	efSAFE_DELETE( mThread );

	/// Delete the watches
	WatchList::iterator it = mWatches.begin();

	for ( ; it != mWatches.end(); it++ )
	{
		efSAFE_DELETE( (*it) );
	}
}
Beispiel #3
0
void Thread::terminate()
{
	if ( mThreadImpl )
	{
		mThreadImpl->terminate();

		efSAFE_DELETE( mThreadImpl );
	}
}
Beispiel #4
0
void Thread::wait()
{
	if ( mThreadImpl )
	{
		mThreadImpl->wait();

		efSAFE_DELETE( mThreadImpl );
	}
}
Beispiel #5
0
FileWatcherWin32::~FileWatcherWin32()
{
	WatchVector::iterator iter = mWatches.begin();

	mWatchesLock.lock();

	for(; iter != mWatches.end(); ++iter)
	{
		DestroyWatch((*iter));
	}

	mHandles.clear();
	mWatches.clear();

	mInitOK = false;

	mWatchesLock.unlock();

	efSAFE_DELETE( mThread );
}
void FileWatcherGeneric::removeWatch( const std::string& directory )
{
	WatchList::iterator it = mWatches.begin();

	for ( ; it != mWatches.end(); it++ )
	{
		if ( (*it)->Directory == directory )
		{
			WatcherGeneric * watch = (*it);

			mWatchesLock.lock();

			mWatches.erase( it );

			efSAFE_DELETE( watch ) ;

			mWatchesLock.unlock();

			return;
		}
	}
}
void FileWatcherGeneric::removeWatch(WatchID watchid)
{
	WatchList::iterator it = mWatches.begin();

	for ( ; it != mWatches.end(); it++ )
	{
		if ( (*it)->ID == watchid )
		{
			WatcherGeneric * watch = (*it);

			mWatchesLock.lock();

			mWatches.erase( it );

			efSAFE_DELETE( watch ) ;

			mWatchesLock.unlock();

			return;
		}
	}
}
Beispiel #8
0
FileWatcher::~FileWatcher()
{
	efSAFE_DELETE( mImpl );
}
Beispiel #9
0
WatcherGeneric::~WatcherGeneric()
{
	efSAFE_DELETE( DirWatch );
}
Beispiel #10
0
Thread::~Thread()
{
	wait();

	efSAFE_DELETE( mEntryPoint );
}