예제 #1
0
        public static ThreadedActionInvoker ToThreadedActionInvoker(this ThreadedAction handler)
        {
            var x = new ThreadedActionInvoker
            {
                Handler = handler
            };

            x.Thread = new System.Threading.Thread(x.DelayThenInvoke);

            return(x);
        }
예제 #2
0
        public static ThreadedActionInvoker AtDelay(this int ms, ThreadedAction handler)
        {
            var x = handler.ToThreadedActionInvoker();

            x.Delay = ms;

            x.Thread.Name         = "AtDelay " + ms;
            x.Thread.IsBackground = true;
            x.Thread.Start();

            return(x);
        }
		public static ThreadedActionInvoker ToThreadedActionInvoker(ThreadedAction handler)
		{
			var x = new __ThreadedActionInvoker
			{
				Handler = handler
			};

			object t = new __Thread { InternalValue = new java.lang.Thread(x) };

			x.Thread = (System.Threading.Thread)t;

			return x;
		}
예제 #4
0
        public static ThreadedActionInvoker ToThreadedActionInvoker(ThreadedAction handler)
        {
            var x = new __ThreadedActionInvoker
            {
                Handler = handler
            };

            object t = new __Thread {
                InternalValue = new java.lang.Thread(x)
            };

            x.Thread = (System.Threading.Thread)t;

            return(x);
        }
예제 #5
0
        public static void WithTimeout(this int ms, ThreadedAction handler)
        {
            var x = handler.ToThreadedActionInvoker();

            x.Delay = 0;

            x.Thread.Name         = "WithTimeout " + ms;
            x.Thread.IsBackground = true;
            x.Thread.Start();

            if (x.Thread.Join(ms))
            {
                return;
            }


            x.Thread.Abort();
        }
		public static ThreadedActionInvoker AtDelay(this int ms, ThreadedAction handler)
		{
			var x = handler.ToThreadedActionInvoker();

			x.Delay = ms;

			x.Thread.Name = "AtDelay " + ms; 
			x.Thread.IsBackground = true;
			x.Thread.Start();

			return x;
		}
		public static void WithTimeout(this int ms, ThreadedAction handler)
		{
			var x = handler.ToThreadedActionInvoker();

			x.Delay = 0;

			x.Thread.Name = "WithTimeout " + ms;
			x.Thread.IsBackground = true;
			x.Thread.Start();

			if (x.Thread.Join(ms))
				return;

			
			x.Thread.Abort();
		}