コード例 #1
0
ファイル: node.cpp プロジェクト: aoighost/Equalizer
void Node::frameTasksFinish( const uint128_t&, const uint32_t frameNumber )
{
    switch( getIAttribute( IATTR_THREAD_MODEL ))
    {
        case ASYNC:      // No sync, release in frameStart
        case DRAW_SYNC:  // Sync and release in frameDrawFinish
            break;

        case LOCAL_SYNC:
        {
            const Pipes& pipes = getPipes();
            for( Pipes::const_iterator i = pipes.begin(); i != pipes.end(); ++i)
            {
                const Pipe* pipe = *i;
                if( pipe->getTasks() != fabric::TASK_NONE )
                    pipe->waitFrameLocal( frameNumber );
            }
            
            releaseFrameLocal( frameNumber );
            break;
        }
        default:
            LBUNIMPLEMENTED;
    }
}
コード例 #2
0
ファイル: node.cpp プロジェクト: aoighost/Equalizer
void Node::dirtyClientExit()
{
    const Pipes& pipes = getPipes();
    for( PipesCIter i = pipes.begin(); i != pipes.end(); ++i )
    {
        Pipe* pipe = *i;
        pipe->cancelThread();
    }
    transmitter.getQueue().wakeup();
    transmitter.join();
}
コード例 #3
0
ファイル: node.cpp プロジェクト: VMML/Equalizer
void Node::dirtyClientExit()
{
    const Pipes& pipes = getPipes();
    for( PipesCIter i = pipes.begin(); i != pipes.end(); ++i )
    {
        Pipe* pipe = *i;
        pipe->cancelThread();
    }
    getTransmitterQueue()->push( co::ICommand( )); // wake up to exit
    _impl->transmitter.join();
}
コード例 #4
0
ファイル: node.cpp プロジェクト: aoighost/Equalizer
void Node::_finishFrame( const uint32_t frameNumber ) const
{
    const Pipes& pipes = getPipes();
    for( Pipes::const_iterator i = pipes.begin(); i != pipes.end(); ++i )
    {
        const Pipe* pipe = *i;
        LBASSERT( pipe->isThreaded() || pipe->getFinishedFrame()>=frameNumber );

        pipe->waitFrameLocal( frameNumber );
        pipe->waitFrameFinished( frameNumber );
    }
}
コード例 #5
0
ファイル: UEventsManager.cpp プロジェクト: matlabbe/utilite
void UEventsManager::dispatchEvent(UEvent * event, const UEventsSender * sender)
{
	std::list<UEventsHandler*> handlers;

	// Verify if there are pipes with the sender for his type of event
	if(sender)
	{
		handlers = getPipes(sender, event->getClassName());
	}

	handlersMutex_.lock();
	if(handlers.size() == 0)
	{
		//No pipes, send to all handlers
		handlers = handlers_;
	}

	for(std::list<UEventsHandler*>::iterator it=handlers.begin(); it!=handlers.end(); ++it)
	{
		// Check if the handler is still in the
		// handlers_ list (may be changed if addHandler() or
		// removeHandler() is called in EventsHandler::handleEvent())
		if(std::find(handlers_.begin(), handlers_.end(), *it) != handlers_.end())
		{
			UEventsHandler * handler = *it;
			handlersMutex_.unlock();

			// Don't process event if the handler is the same as the sender
			if(handler != sender)
			{
				// To be able to add/remove an handler in a handleEvent call (without a deadlock)
				// @see _addHandler(), _removeHandler()
				handler->handleEvent(event);
			}

			handlersMutex_.lock();
		}
	}
	handlersMutex_.unlock();
}
コード例 #6
0
ファイル: node.cpp プロジェクト: aoighost/Equalizer
bool Node::_cmdConfigExit( co::Command& command )
{
    LB_TS_THREAD( _nodeThread );
    LBLOG( LOG_INIT ) << "Node exit " 
                      << command.get<NodeConfigExitPacket>() << std::endl;

    const Pipes& pipes = getPipes();
    for( Pipes::const_iterator i = pipes.begin(); i != pipes.end(); ++i )
    {
        Pipe* pipe = *i;
        pipe->waitExited();
    }
    
    _state = configExit() ? STATE_STOPPED : STATE_FAILED;
    transmitter.getQueue().wakeup();
    transmitter.join();
    _flushObjects();

    ConfigDestroyNodePacket destroyPacket( getID( ));
    getConfig()->send( getLocalNode(), destroyPacket );
    return true;
}
コード例 #7
0
ファイル: node.cpp プロジェクト: VMML/Equalizer
bool Node::_cmdConfigExit( co::ICommand& cmd )
{
    co::ObjectICommand command( cmd );

    LB_TS_THREAD( _nodeThread );
    LBLOG( LOG_INIT ) << "Node exit " << command << std::endl;

    const Pipes& pipes = getPipes();
    for( PipesCIter i = pipes.begin(); i != pipes.end(); ++i )
    {
        Pipe* pipe = *i;
        pipe->waitExited();
    }

    _impl->state = configExit() ? STATE_STOPPED : STATE_FAILED;
    getTransmitterQueue()->push( co::ICommand( )); // wake up to exit
    _impl->transmitter.join();
    _flushObjects();

    getConfig()->send( getLocalNode(),
                       fabric::CMD_CONFIG_DESTROY_NODE ) << getID();
    return true;
}
コード例 #8
0
ファイル: node.cpp プロジェクト: aoighost/Equalizer
Node::~Node()
{
    LBASSERT( getPipes().empty( ));
}
コード例 #9
0
ファイル: node.cpp プロジェクト: VMML/Equalizer
Node::~Node()
{
    LBASSERT( getPipes().empty( ));
    delete _impl;
}