void CLibraryMetaPanel::OnRun()
{
	m_pSection.Lock();

	while ( IsThreadEnabled() )
	{	
		CString strPath = m_sPath;

		if ( strPath.IsEmpty() )
			break;

		m_pSection.Unlock();

		CImageFile pFile;
		BOOL bSuccess = CThumbCache::Cache( strPath, &pFile );

		m_pSection.Lock();

		// If nothing changes
		if ( m_sPath == strPath )
		{
			if ( bSuccess )
			{
				if ( m_bmThumb.m_hObject )
					m_bmThumb.DeleteObject();

				m_bmThumb.Attach( pFile.CreateBitmap() );
			}

			Invalidate();

			break;
		}
	}

	m_pSection.Unlock();
}
void CLibraryTipCtrl::OnRun()
{
	while ( IsThreadEnabled() )
	{
		Doze( 1000 );

		if ( ! IsThreadEnabled() )
			break;

		m_pSection.Lock();
		CString strPath = m_sPath;
		m_pSection.Unlock();

		if ( strPath.IsEmpty() )	// ToDo: Make preview requests by hash?
			continue;

		CImageFile pFile;
		BOOL bSuccess = CThumbCache::Cache( strPath, &pFile );

		m_pSection.Lock();

		if ( m_bmThumb.m_hObject ) m_bmThumb.DeleteObject();

		if ( m_sPath == strPath )
		{
			m_sPath.Empty();

			if ( bSuccess )
			{
				m_bmThumb.Attach( pFile.CreateBitmap() );
				Invalidate();
			}
		}

		m_pSection.Unlock();
	}
}