public void setupTLS()
 {
     if (tls == null)
         tls = new TLS
         {
             calling_in_this_thread = ROS.getPID()
         };
 }
 public void setupTLS()
 {
     if (tls == null)
     {
         tls = new TLS
         {
             calling_in_this_thread = ROS.getPID()
         }
     }
     ;
 }
        public CallOneResult callOneCB(TLS tls)
        {
            ICallbackInfo info = tls.head;

            if (info == null)
            {
                return(CallOneResult.Empty);
            }
            IDInfo idinfo = null;

            idinfo = getIDInfo(info.removal_id);
            if (idinfo != null)
            {
                CallbackInterface cb = info.Callback;
                lock (idinfo.calling_rw_mutex)
                {
                    CallbackInterface.CallResult result = CallbackInterface.CallResult.Invalid;
                    tls.spliceout(info);
                    if (!info.marked_for_removal)
                    {
                        result = cb.Call();
                    }
                    if (result == CallbackInterface.CallResult.TryAgain && !info.marked_for_removal)
                    {
                        lock (mutex)
                        {
                            callbacks.Add(info);
                            Count++;
                        }
                        return(CallOneResult.TryAgain);
                    }
                }
                return(CallOneResult.Called);
            }
            ICallbackInfo cbi = tls.spliceout(info);

            if (cbi != null)
            {
                cbi.Callback.Call();
            }
            return(CallOneResult.Called);
        }
 public CallOneResult callOneCB(TLS tls)
 {
     ICallbackInfo info = tls.head;
     if (info == null)
         return CallOneResult.Empty;
     IDInfo idinfo = null;
     idinfo = getIDInfo(info.removal_id);
     if (idinfo != null)
     {
         CallbackInterface cb = info.Callback;
         lock (idinfo.calling_rw_mutex)
         {
             CallbackInterface.CallResult result = CallbackInterface.CallResult.Invalid;
             tls.spliceout(info);
             if (!info.marked_for_removal)
             {
                 result = cb.Call();
             }
             if (result == CallbackInterface.CallResult.TryAgain && !info.marked_for_removal)
             {
                 lock (mutex)
                 {
                     callbacks.Add(info);
                     Count++;
                 }
                 return CallOneResult.TryAgain;
             }
         }
         return CallOneResult.Called;
     }
     ICallbackInfo cbi = tls.spliceout(info);
     if (cbi != null)
         cbi.Callback.Call();
     return CallOneResult.Called;
 }