internal void drop()
 {
     lock (client_links_mutex)
     {
         isDropped = true;
     }
     dropAllConnections();
     callback.removeByID(ROS.getPID());
 }
示例#2
0
 public void setupTLS()
 {
     if (tls == null)
     {
         tls = new TLS
         {
             calling_in_this_thread = ROS.getPID()
         }
     }
     ;
 }
示例#3
0
        public void addCallbacks(SubscriberCallbacks callbacks)
        {
            lock (callbacks_mutex)
            {
                this.callbacks.Add(callbacks);
                if (callbacks.connect != null && callbacks.Callback != null)
                {
                    lock (subscriber_links_mutex)
                    {
                        foreach (SubscriberLink i in subscriber_links)
                        {
                            CallbackInterface cb = new PeerConnDisconnCallback(callbacks.connect, i);

                            callbacks.Callback.addCallback(cb, ROS.getPID());
                        }
                    }
                }
            }
        }
示例#4
0
 public UInt64 Get()
 {
     return(ROS.getPID());
 }
示例#5
0
 public virtual void addCallback(CallbackInterface callback)
 {
     addCallback(callback, ROS.getPID());
 }
示例#6
0
        public bool call(IRosMessage req, ref IRosMessage resp)
        {
            CallInfo info = new CallInfo {
                req = req, resp = resp, success = false, finished = false, call_finished = false, caller_thread_id = ROS.getPID()
            };

            bool immediate = false;

            lock (call_queue_mutex)
            {
                if (connection.dropped)
                {
                    info.call_finished = true;
                    return(false);
                }
                if (call_queue.Count == 0 && header_written && header_read)
                {
                    immediate = true;
                }
                call_queue.Enqueue(info);
            }

            if (immediate)
            {
                processNextCall();
            }

            while (!info.finished)
            {
                info.finished_condition.WaitOne();
            }

            lock (info.finished_mutex)
            {
                info.call_finished = true;
            }

            if (info.exception.Length > 0)
            {
                ROS.Error("Service call failes: service [{0}] responded with an error: {1}", name, info.exception);
            }
            return(info.success);
        }
        public override void processRequest(ref byte[] buf, int num_bytes, IServiceClientLink link)
        {
            CallbackInterface cb = new ServiceCallback(this, helper, buf, num_bytes, link, has_tracked_object, tracked_object);

            callback.addCallback(cb, ROS.getPID());
        }