コード例 #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);
        }
コード例 #3
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;
		}
コード例 #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();
        }
コード例 #6
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;
		}
コード例 #7
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();
		}