Beispiel #1
0
void fastPoll( void )
	{
	RANDOM_STATE randomState;
	BYTE buffer[ RANDOM_BUFSIZE ];
	SYSHEAPINFO sysHeapInfo;
	MEMMANINFO memManInfo;
	TIMERINFO timerInfo;
	POINT point;

	initRandomData( randomState, buffer, RANDOM_BUFSIZE );

	/* Get various basic pieces of system information: Handle of the window
	   with mouse capture, handle of window with input focus, amount of
	   space in global heap, whether system queue has any events, cursor
	   position for last message, 55 ms time for last message, number of
	   active tasks, 55 ms time since Windows started, current mouse cursor
	   position, current caret position */
	addRandomValue( randomState, GetCapture() );
	addRandomValue( randomState, GetFocus() );
	addRandomValue( randomState, GetFreeSpace( 0 ) );
	addRandomValue( randomState, GetInputState() );
	addRandomValue( randomState, GetMessagePos() );
	addRandomValue( randomState, GetMessageTime() );
	addRandomValue( randomState, GetNumTasks() );
	addRandomValue( randomState, GetTickCount() );
	GetCursorPos( &point );
	addRandomData( randomState, &point, sizeof( POINT ) );
	GetCaretPos( &point );
	addRandomData( randomState, &point, sizeof( POINT ) );

	/* Get the largest free memory block, number of lockable pages, number of
	   unlocked pages, number of free and used pages, and number of swapped
	   pages */
	memManInfo.dwSize = sizeof( MEMMANINFO );
	MemManInfo( &memManInfo );
	addRandomData( randomState, &memManInfo, sizeof( MEMMANINFO ) );

	/* Get the execution times of the current task and VM to approximately
	   1ms resolution */
	timerInfo.dwSize = sizeof( TIMERINFO );
	TimerCount( &timerInfo );
	addRandomData( randomState, &timerInfo, sizeof( TIMERINFO ) );

	/* Get the percentage free and segment of the user and GDI heap */
	sysHeapInfo.dwSize = sizeof( SYSHEAPINFO );
	SystemHeapInfo( &sysHeapInfo );
	addRandomData( randomState, &sysHeapInfo, sizeof( SYSHEAPINFO ) );

	/* Flush any remaining data through */
	endRandomData( randomState, 25 );
	}
///fills in the status bar message for a given track
void ODWaveTrackTaskQueue::FillTipForWaveTrack( WaveTrack * t, const wxChar ** ppTip )
{
   if(ContainsWaveTrack(t) && GetNumTasks())
   {
      
    //  if(GetNumTasks()==1)
      mTipMsg.Printf(_("%s %2.0f%% complete.  Click to change task focal point."), GetFrontTask()->GetTip(), GetFrontTask()->PercentComplete()*100.0 );
     // else
       //  msg.Printf(_("%s %n additional tasks remaining."), GetFrontTask()->GetTip().c_str(), GetNumTasks());
       
      *ppTip = mTipMsg.c_str();
   
   }
}
Beispiel #3
0
bool WaitTaskExecution(UINT /*ntc*/)
{
#if 0
	CTimeSpan timeOut;
	CTime tStart = CTime::GetCurrentTime(), tCurr;

	timeOut = 20;
	while (GetNumTasks() == ntc)
	{
		if (!AfxGetApp()->PumpMessage())
			return FALSE;

		if (tStart + timeOut < CTime::GetCurrentTime())
		{
			TRACE("Timeout waiting for start\n");
			return FALSE;
		}
	}

	timeOut = 60 * 3;
	while (GetNumTasks() > ntc)
	{
		if (!AfxGetApp()->PumpMessage())
			return FALSE;

		if (tStart + timeOut < CTime::GetCurrentTime())
		{
			TRACE("Timeout waiting for end\n");
			return FALSE;
		}
	}

	return TRUE;
#else
	return FALSE;
#endif
}
///returns whether or not this queue's task list and another's can merge together, as when we make two mono tracks stereo.
bool ODWaveTrackTaskQueue::CanMergeWith(ODWaveTrackTaskQueue* otherQueue)
{
   //have to be very careful when dealing with two lists that need to be locked.
   if(GetNumTasks()!=otherQueue->GetNumTasks())
      return false;
   
   mTasksMutex.Lock();
   for(unsigned int i=0;i<mTasks.size();i++)
   {
      if(!mTasks[i]->CanMergeWith(otherQueue->GetTask(i)))
      {
         mTasksMutex.Unlock();
         return false;
      }
   }
   mTasksMutex.Unlock();
   return true;
}