Exemplo n.º 1
0
//******************************************************************************
void OSF1Timer::StartTimer()
{
    if (getIsRunning())
        return;

    IncrementInvocationCount();
    gettimeofday(&StartTime,NULL);

    setIsRunning(true);
}
/**
 * This is a singleton component, which is started through its control frontend on-demand at
 * runtime and terminates when it's done.
 * We have to ensure (in cooperation with the control frontend) that we don't get multiple instances
 * of this thread running at the same time.
 */
void FileResyncerGatherSlave::run()
{
   setIsRunning(true);

   try
   {
      registerSignalHandler();

      walkAllMetadata();

      log.log(Log_DEBUG, "Component stopped.");
   }
   catch(std::exception& e)
   {
      PThread::getCurrentThreadApp()->handleComponentException(e);
   }

   setIsRunning(false);
}
Exemplo n.º 3
0
//******************************************************************************
void OSF1Timer::StopTimer()
{
    if(!getIsRunning())
        return;

    gettimeofday(&StopTime,NULL);

    setIsRunning(false);

    AddToCumulativeTime(Ticks());
}
Exemplo n.º 4
0
void Importer::clearDict(int type)
{
    if (!m_iface || !m_iface->isValid() || m_running) {
        return;
    }

    setIsRunning(true);

    QDBusPendingCall call = m_iface->asyncCall("ClearDict", type);
    QDBusPendingCallWatcher* watcher = new QDBusPendingCallWatcher(call, m_iface);
    connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(callFinished(QDBusPendingCallWatcher*)));
}
Exemplo n.º 5
0
void ThreadEnv::compute( Graph& graph, const NodeListArg& nodes )
{
	if( _asynchronous )
	{
		setIsRunning(true);
		_thread = boost::thread( runProcessFunc, this, graph, nodes.getNodes() );
	}
	else
	{
		setResult( graph.compute( _imageCache, nodes, _options ) );
	}
}
Exemplo n.º 6
0
//*****************************************************************************
PerformanceTimer::PerformanceTimer()
{
    setIsRunning(false);
    InvCount = 0;
    CumulativeTime = 0;
}
Exemplo n.º 7
0
void Importer::callFinished(QDBusPendingCallWatcher* watcher)
{
    watcher->deleteLater();
    setIsRunning(false);
}
Exemplo n.º 8
0
void Importer::onDisconnected()
{
    delete m_iface;
    m_iface = 0;
    setIsRunning(false);
}
Exemplo n.º 9
0
void CDXSimpleThread::run() {
	emit setIsRunning( true );
	init();

	delayTime = 10;	// initial delay time
	frameCounter = 0;
	frameTimer.start();

	while( !*stopThread ) {
		if ( *readyToProcess == true ) {
			// Check resolution		
			D3DDISPLAYMODE ddm;
			if( FAILED( g_pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &ddm ) ) ) {
				throw( "Unable to get adapter display mode" );
				//break;
			}
			if ( ddm.Height != ScreenHeight || ddm.Width != ScreenWidth ) {
				cleanup();
				init();
			}
		
			// Capture screen
			g_pd3dDevice->GetFrontBufferData( 0, pSurface );
			D3DLOCKED_RECT lockedRect;
			pSurface->LockRect( &lockedRect, NULL, D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_NOSYSLOCK | D3DLOCK_READONLY );
	
			for( int i=0 ; i < ScreenHeight ; i++ )	{
				memcpy( buf + i * ScreenWidth * BITS_PER_PIXEL / 8, (BYTE*)lockedRect.pBits + i* lockedRect.Pitch, ScreenWidth * BITS_PER_PIXEL / 8 );
			}
			pSurface->UnlockRect();

			CRegions * regions = new CRegions( settings->getHorizontalSegmentWidth( ScreenWidth ), settings->getHorizontalHeight( ScreenHeight ),
				settings->getVerticalWidth( ScreenWidth ), settings->getVerticalSegmentHeight( ScreenHeight ) )	;
			
			// Horizontal
			// Top
			for( int i = 0; i < settings->LEDnumH; i++ ) {
				unsigned char * buf_tmp = new unsigned char[ regions->hWidth * regions->hHeight * BITS_PER_PIXEL / 8 ];
				for( int x = 0; x < regions->hHeight; x++ )
					memcpy( buf_tmp + x * regions->hWidth * BITS_PER_PIXEL / 8, buf + ( x * ScreenWidth + i * regions->hWidth ) * BITS_PER_PIXEL / 8, regions->hWidth * BITS_PER_PIXEL / 8 );

				regions->regionHTop.push_back( buf_tmp );
			}

			// Bottom
			for( int i = 0; i < settings->LEDnumH; i++ ) {
				unsigned char * buf_tmp = new unsigned char[ regions->hWidth * regions->hHeight * BITS_PER_PIXEL / 8 ];
				for( int x = 0; x < regions->hHeight; x++ )
					memcpy( buf_tmp + x * regions->hWidth * BITS_PER_PIXEL / 8, buf + ( ( ScreenHeight - regions->hHeight ) * ScreenWidth + x * ScreenWidth + i * regions->hWidth ) * BITS_PER_PIXEL / 8, regions->hWidth * BITS_PER_PIXEL / 8 );
				
				regions->regionHBottom.push_back( buf_tmp );
			}

			// Verticals
			// Left
			for ( int i = 0; i < settings->LEDnumV; i++ ) {
				unsigned char * buf_tmp = new unsigned char[ regions->vWidth * regions->vHeight * BITS_PER_PIXEL / 8 ];
				for( int x = 0; x < regions->vHeight; x++ )
					memcpy( buf_tmp + x * regions->vWidth * BITS_PER_PIXEL / 8, buf + ( i * regions->vHeight * ScreenWidth + x * ScreenWidth ) * BITS_PER_PIXEL / 8, regions->vWidth * BITS_PER_PIXEL / 8 );
				
				regions->regionVLeft.push_back( buf_tmp );
			}

			// Right
			for ( int i = 0; i < settings->LEDnumV; i++ ) {
				unsigned char * buf_tmp = new unsigned char[ regions->vWidth * regions->vHeight * BITS_PER_PIXEL / 8 ];
				for( int x = 0; x < regions->vHeight; x++ )
					memcpy( buf_tmp + x * regions->vWidth * BITS_PER_PIXEL / 8, buf + ( i * regions->vHeight *  ScreenWidth + ( ScreenWidth - regions->vWidth ) + x * ScreenWidth ) * BITS_PER_PIXEL / 8, regions->vWidth * BITS_PER_PIXEL / 8 );
				
				regions->regionVRight.push_back( buf_tmp );
			}

			*readyToProcess = false;
			emit onImageCaptured( regions );			
			++frameCounter;
			updateDelayTime();
		}
		usleep( delayTime );
	}
	cleanup();
	emit setIsRunning( false );
	//*stopThread = true;
}
Exemplo n.º 10
0
void CUniCaptureThread::run() {
	emit setIsRunning( true );
	init();

	delayTime = 10;	// initial delay time
	frameCounter = 0;
	frameTimer.start();
	
	while( !*stopThread ) {
		if ( *readyToProcess == true ) {			
			// Check resolution changes
			QRect screenGeometry = scr->geometry();

			int nScreenWidth  = screenGeometry.width();
			int nScreenHeight = screenGeometry.height();

			if ( nScreenWidth != ScreenWidth || nScreenHeight != ScreenHeight )	{
				ScreenWidth = nScreenWidth;
				ScreenHeight = nScreenHeight;

				cleanupBuffers();
				initBuffers();
			}  

			// Creating and filling regions data
			CRegions * regions = new CRegions( settings->getHorizontalSegmentWidth( ScreenWidth ), settings->getHorizontalHeight( ScreenHeight ),
				settings->getVerticalWidth( ScreenWidth ), settings->getVerticalSegmentHeight( ScreenHeight ) );
			
			// Horizontals
			// Top
			for ( unsigned short x = 0; x < settings->LEDnumH; x++ ) {
				QImage im = scr->grabWindow( desktopID, x * regions->hWidth, 0, regions->hWidth, regions->hHeight ).toImage();
				unsigned char * bufH_tmp = new unsigned char[ bufHSize ];
				memcpy( bufH_tmp, im.bits(), bufHSize );

				regions->regionHTop.push_back( bufH_tmp );
			}
			
			// Bottom
			for ( unsigned short x = 0; x < settings->LEDnumH; x++ ) {
				QImage im = scr->grabWindow( desktopID, x * regions->hWidth, ScreenHeight - regions->hHeight, regions->hWidth, regions->hHeight ).toImage();
				unsigned char * bufH_tmp = new unsigned char[ bufHSize ];
				memcpy( bufH_tmp, im.bits(), bufHSize );

				regions->regionHBottom.push_back( bufH_tmp );			
			}

			// Verticals
			// Left
			for ( int x = 0; x < settings->LEDnumV; x++ ) {
				QImage im = scr->grabWindow( desktopID, 0, x * regions->vHeight, regions->vWidth, regions->vHeight ).toImage();
				unsigned char * bufV_tmp = new unsigned char[ bufVSize ];
				memcpy( bufV_tmp, im.bits(), bufVSize );

				regions->regionVLeft.push_back( bufV_tmp );
			}
			
			// Right
			for ( int x = 0; x < settings->LEDnumV; x++ ) {
				QImage im = scr->grabWindow( desktopID, ScreenWidth - regions->vWidth, x * regions->vHeight, regions->vWidth, regions->vHeight ).toImage();
				unsigned char * bufV_tmp = new unsigned char[ bufVSize ];
				memcpy( bufV_tmp, im.bits(), bufVSize );

				regions->regionVRight.push_back( bufV_tmp );			
			}

			*readyToProcess = false;
			emit onImageCaptured( regions );
			++frameCounter;
			updateDelayTime();
		}		
		usleep( delayTime );
	}

	cleanup();
	emit setIsRunning( false );
	//*stopThread = true;
}
Exemplo n.º 11
0
void CGDISimpleThread::run() {
	emit setIsRunning( true );
	init();

	delayTime = 10;	// initial delay time
	frameCounter = 0;
	frameTimer.start();
	
	while( !*stopThread ) {
		if ( *readyToProcess == true ) {
			// Check for resolution changes
			int nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
			int nScreenHeight = GetSystemMetrics(SM_CYSCREEN);

			if ( nScreenWidth != ScreenWidth || nScreenHeight != ScreenHeight )	{
				ScreenWidth = nScreenWidth;
				ScreenHeight = nScreenHeight;

				cleanupBuffers();
				initBuffers();
			}  

			// Creating and filling regions data
			CRegions * regions = new CRegions( settings->getHorizontalSegmentWidth( ScreenWidth ), settings->getHorizontalHeight( ScreenHeight ),
				settings->getVerticalWidth( ScreenWidth ), settings->getVerticalSegmentHeight( ScreenHeight ) );

			// Horizontals
			SelectObject( hCaptureDC, hCaptureBitmapH );
			// Top
			for ( unsigned short x = 0; x < settings->LEDnumH; x++ ) {
				BitBlt( hCaptureDC, 0, 0, regions->hWidth, regions->hHeight, hDesktopDC, x * regions->hWidth, 0, SRCCOPY|CAPTUREBLT );
				GetBitmapBits( hCaptureBitmapH, bufHSize, bufH );

				unsigned char * bufH_tmp = new unsigned char[ bufHSize ];
				memcpy( bufH_tmp, bufH, bufHSize );

				regions->regionHTop.push_back( bufH_tmp );
			}
			
			// Bottom
			for ( unsigned short x = 0; x < settings->LEDnumH; x++ ) {
				BitBlt( hCaptureDC, 0, 0, regions->hWidth, regions->hHeight, hDesktopDC, x * regions->hWidth, ScreenHeight - regions->hHeight, SRCCOPY|CAPTUREBLT );
				GetBitmapBits( hCaptureBitmapH, bufHSize, bufH );

				unsigned char * bufH_tmp = new unsigned char[ bufHSize ];
				memcpy( bufH_tmp, bufH, bufHSize );

				regions->regionHBottom.push_back( bufH_tmp );			
			}

			// Verticals
			SelectObject(hCaptureDC,hCaptureBitmapV);
			// Left
			for ( int x = 0; x < settings->LEDnumV; x++ ) {
				BitBlt( hCaptureDC, 0, 0, regions->vWidth, regions->vHeight, hDesktopDC, 0, x * regions->vHeight, SRCCOPY|CAPTUREBLT );
				GetBitmapBits( hCaptureBitmapV, bufVSize, bufV );

				unsigned char * bufV_tmp = new unsigned char[ bufVSize ];
				memcpy( bufV_tmp, bufV, bufVSize );

				regions->regionVLeft.push_back( bufV_tmp );
			}
			
			// Right
			for ( int x = 0; x < settings->LEDnumV; x++ ) {
				BitBlt( hCaptureDC, 0, 0, regions->vWidth, regions->vHeight, hDesktopDC, ScreenWidth - regions->vWidth, x * regions->vHeight, SRCCOPY|CAPTUREBLT );
				GetBitmapBits( hCaptureBitmapV, bufVSize, bufV );

				unsigned char * bufV_tmp = new unsigned char[ bufVSize ];
				memcpy( bufV_tmp, bufV, bufVSize );

				regions->regionVRight.push_back( bufV_tmp );			
			}

			*readyToProcess = false;
			emit onImageCaptured( regions );
			++frameCounter;
			updateDelayTime();
		}		
		usleep( delayTime );
	}
	cleanup();
	emit setIsRunning( false );
	//*stopThread = true;
}