예제 #1
0
void LogConCenPH::checkAllActive(){
	int ak = getAK();
	vector<double> lims; 
	for(int i = 1; i < (ak-1); i++){
		if(getAK() > i){
			lims = getLimits(actIndex[i]);
			if(lims[0] > -slpTol){
				removeActive(actIndex[i]);
			}
		}
	}
}
예제 #2
0
파일: signal.cpp 프로젝트: cgestes/libqi
  void SignalSubscriber::call(const GenericFunctionParameters& args, MetaCallType callType)
  {
    // this is held alive by caller
    if (handler)
    {
      bool async = true;
      if (threadingModel != MetaCallType_Auto)
        async = (threadingModel == MetaCallType_Queued);
      else if (callType != MetaCallType_Auto)
        async = (callType == MetaCallType_Queued);

      qiLogDebug() << "subscriber call async=" << async <<" ct " << callType <<" tm " << threadingModel;
      if (async)
      {
        GenericFunctionParameters* copy = new GenericFunctionParameters(args.copy());
        // We will check enabled when we will be scheduled in the target
        // thread, and we hold this SignalSubscriber alive, so no need to
        // explicitly track the asynccall

        // courtesy-check of el, but it should be kept alive longuer than us
        qi::EventLoop* el = getEventLoop();
        if (!el) // this is an assert basicaly, no sense trying to do something clever.
          throw std::runtime_error("Event loop was destroyed");
        el->post(FunctorCall(copy, new SignalSubscriberPtr(shared_from_this())));
      }
      else
      {
        // verify-enabled-then-register-active op must be locked
        {
          boost::mutex::scoped_lock sl(mutex);
          if (!enabled)
            return;
          addActive(false);
        }
        //do not throw
        bool mustDisconnect = false;
        try
        {
          handler(args);
        }
        catch(const qi::PointerLockException&)
        {
          qiLogDebug() << "PointerLockFailure excepton, will disconnect";
          mustDisconnect = true;
        }
        catch(const std::exception& e)
        {
          qiLogWarning() << "Exception caught from signal subscriber: " << e.what();
        }
        catch (...)
        {
          qiLogWarning() << "Unknown exception caught from signal subscriber";
        }
        removeActive(true);
        if (mustDisconnect)
          source->disconnect(linkId);
      }
    }
    else if (target)
    {
      AnyObject lockedTarget = target->lock();
      if (!lockedTarget)
      {
        source->disconnect(linkId);
      }
      else // no need to keep anything locked, whatever happens this is not used
        lockedTarget.metaPost(method, args);
    }
  }