std::future< BlockResult > BlockStateHandler::startRunning( std::shared_ptr< UpdateTrigger_I > trigger )
	{
#ifdef _DEBUG
		assert( trigger );
#endif
		mMutex.lock();
		std::shared_ptr< SignalResponse > response = mState->onStartRunning();
		// store trigger for later, otherwise it's null
		response->updateTrigger = trigger;
		return carryOut( response );
	}
Exemple #2
0
STATIC RET_T perform( TARGET *targ, DEPEND *dep, DEPEND *impldep, time_t max_time )
/*********************************************************************************/
{
    CLIST   *clist;
    CLIST   *before;
    RET_T   ret;
    DEPEND  *depend;
    DEPEND  *impliedDepend;

    depend = NULL;
    impliedDepend = NULL;
    assert( targ != NULL && dep != NULL );

    if( Glob.query ) {
        ++cListCount;
        return( RET_WARN );
    }
    if( Glob.touch ) {
        ++cListCount;
        ResetExecuted();
        if( !targ->attr.symbolic ) {
            CacheRelease();
            if( TouchFile( targ->node.name ) != RET_SUCCESS ) {
                PrtMsg( ERR | COULD_NOT_TOUCH, targ->node.name );
                return( RET_ERROR );
            }
        }
        targ->touched = true;
        return( RET_SUCCESS );
    }

    /* means that this is a sufsuf made implicit rule */
    if( impldep == NULL ) {
        clist = dep->clist;
        depend = dep;
        impliedDepend = NULL;
    } else {
        clist = impldep->clist;
        depend = targ->depend;
        impliedDepend = dep;
    }
    if( clist == NULL ) {
        clist = DotCList( DOT_DEFAULT );
        if( clist == NULL ) {
            // No commands in Microsoft and POSIX mode is considered OK
            // and executed
            if( Glob.compat_nmake || Glob.compat_posix ) {
                targ->cmds_done = true;
                return( RET_SUCCESS );
            }
            if( targ->attr.symbolic != false ) {
                targ->cmds_done = true;
                return( RET_SUCCESS );
            }
            if( targ->allow_nocmd ) {
                /* for UNIX folks: make target symbolic */
                targ->attr.symbolic = true;
                return( RET_SUCCESS );
            }
            PrtMsg( FTL | NO_DEF_CMDS_FOR_MAKE, DotNames[DOT_DEFAULT], targ->node.name );
            ExitFatal();
        }
    }
    if( !Glob.noexec ) {
        ResetExecuted();
    }
    if( !doneBefore ) {
        before = DotCList( DOT_BEFORE );
        if( before != NULL ) {
            ++cListCount;
            if( ExecCList( before ) != RET_SUCCESS ) {
                PrtMsg( FTL | S_COMMAND_RET_BAD, DotNames[DOT_BEFORE] );
                ExitFatal();
            }
        }
        doneBefore = true;
    }
    exPush( targ, depend, impliedDepend );
    ret = carryOut( targ, clist, findMaxTime( targ, dep, max_time ) );
    exPop();
    if( ret == RET_ERROR ) {
        ExitError();
    }
    return( ret );
}
	std::future< BlockResult > BlockStateHandler::stopRunning()
	{
		mMutex.lock();
		std::shared_ptr< SignalResponse > response = mState->onStopRunning();
		return carryOut( response );
	}
	std::future< BlockResult > BlockStateHandler::shutdown()
	{
		mMutex.lock();
		std::shared_ptr< SignalResponse > response = mState->onShutdownSignalReceived();
		return carryOut( response );
	}
	std::future< BlockResult > BlockStateHandler::singlestep()
	{	
		mMutex.lock();
		std::shared_ptr< SignalResponse > response = mState->onSingleUpdateSignalReceived();
		return carryOut( response );
	}
	void BlockStateHandler::update()
	{
		mMutex.lock();
		std::shared_ptr< SignalResponse > response = mState->onUpdateSignalReceived();
		carryOut( response );
	}