• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Runnable类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Runnable的典型用法代码示例。如果您正苦于以下问题:C# Runnable类的具体用法?C# Runnable怎么用?C# Runnable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Runnable类属于命名空间,在下文中一共展示了Runnable类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: NewThread

		public Thread NewThread (Runnable r)
		{
			Thread t = new Thread (r);
			t.SetDaemon (true);
			t.Start ();
			return t;
		}
开发者ID:renaud91,项目名称:n-metadata-extractor,代码行数:7,代码来源:ThreadFactory.cs


示例2: post

 //================================================================
 //Getter and Setter
 //================================================================
 //================================================================
 //Methodes
 //================================================================
 public void post(Runnable run)
 {
     if (run != null)
     {
         runnables.Add(run);
     }
 }
开发者ID:backviet01,项目名称:winengine,代码行数:13,代码来源:RunnableUpdateHandler.cs


示例3: NewThread

			public Sharpen.Thread NewThread(Runnable taskBody)
			{
				Sharpen.Thread thr = this.baseFactory.NewThread(taskBody);
				thr.SetName("JGit-AlarmQueue");
				thr.SetDaemon(true);
				return thr;
			}
开发者ID:LunarLanding,项目名称:ngit,代码行数:7,代码来源:BatchingProgressMonitor.cs


示例4: NewThread

 public SharpenThread NewThread (Runnable r)
 {
     SharpenThread t = new SharpenThread (r);
     t.SetDaemon (true);
     t.Start ();
     return t;
 }
开发者ID:DotNetEra,项目名称:couchbase-lite-net,代码行数:7,代码来源:ThreadFactory.cs


示例5: schedule

        private schedule(Runnable task, long delay, TimeUnit unit)
        {
            Preconditions.checkState(isOpen.get(), "CloseableExecutorService is closed");

            InternalFutureTask<void> futureTask = new InternalFutureTask<void>(new FutureTask<void>(task, null));
            scheduledExecutorService.schedule(futureTask, delay, unit);
            return futureTask;
        }
开发者ID:shayhatsor,项目名称:curator,代码行数:8,代码来源:CloseableScheduledExecutorService.cs


示例6: tryCatch

 public static Exception tryCatch(Runnable runnable) {
   try {
     runnable.run();
     return null;
   } catch (Exception exception) {
     return exception;
   }
 }
开发者ID:habibutsu,项目名称:scala-2.4.x,代码行数:8,代码来源:ExceptionHandling.cs


示例7: StartPlayingHandler

		private void StartPlayingHandler()
		{
			var handler = new Handler();
			var runnable = new Runnable(() => { handler.Post(OnPlaying); });
			if (!_executorService.IsShutdown)
			{
				_scheduledFuture = _executorService.ScheduleAtFixedRate(runnable, 100, 1000, TimeUnit.Milliseconds);
			}
		}
开发者ID:martijn00,项目名称:XamarinMediaManager,代码行数:9,代码来源:VideoPlayerImplementation.cs


示例8: ClassRoadie

 public ClassRoadie(RunNotifier notifier, TestClass testClass, Description description, Runnable runnable)
 {
   base.\u002Ector();
   ClassRoadie classRoadie = this;
   this.fNotifier = notifier;
   this.fTestClass = testClass;
   this.fDescription = description;
   this.fRunnable = runnable;
 }
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:9,代码来源:ClassRoadie.cs


示例9: RemoveItem

 public void RemoveItem(Runnable Item)
 {
     for (int i = Item.ExecutionIndex; i < (Count - 1); i++)
     {
         Items[i] = Items[i + 1];
         Items[i].ExecutionIndex = i;
     }
     Count--;
 }
开发者ID:costas-basdekis,项目名称:VersatileParsingLanguage,代码行数:9,代码来源:Compiler.cs


示例10: AddItem

 public void AddItem(Runnable Item)
 {
     if ((Items.Length - Count) < 10)
         IncreaseItemsSize();
     var index = ++Count - 1;
     Items[index] = Item;
     Items[index].ExecutionIndex = index;
     Compiler.OutItem(Item, this);
 }
开发者ID:costas-basdekis,项目名称:VersatileParsingLanguage,代码行数:9,代码来源:Compiler.cs


示例11: enqueueFrame

 public static void enqueueFrame(Runnable frame)
 {
     lock(frameQueue){
         if (frameQueue.Count > MAX_BUFFER){
             frameQueue.Dequeue();
         }
         frameQueue.Enqueue(frame);
         Debug.Log("largo de la cola de los frames = " + frameQueue.Count);
     }
 }
开发者ID:CristianCosta,项目名称:Kinect,代码行数:10,代码来源:FrameDispatcher.cs


示例12: Execute

 public int Execute()
 {
     string[] tokens = configuration.GetItem<Settings>().Runner.Split(',');
     if (tokens.Length > 1) {
         configuration.GetItem<ApplicationUnderTest>().AddAssembly(tokens[1]);
     }
     Runnable = new BasicProcessor().Create(tokens[0]).GetValue<Runnable>();
     ExecuteInApartment();
     return result;
 }
开发者ID:JeffryGonzalez,项目名称:fitsharp,代码行数:10,代码来源:Runner.cs


示例13: Thread

		Thread (Runnable runnable, ThreadGroup grp, string name)
		{
			cancelTokenSource = new CancellationTokenSource ();
			task = new Task (InternalRun, cancelTokenSource.Token, TaskCreationOptions.LongRunning);

			Runnable = runnable ?? this;
			tgroup = grp ?? defaultGroup;
			tgroup.Add (this);
			Name = name ?? "Unknown";
		}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:10,代码来源:Thread.cs


示例14: scheduleWithFixedDelay

        private scheduleWithFixedDelay(Runnable task, long initialDelay, long delay, TimeUnit unit)
        {
            Preconditions.checkState(isOpen.get(), "CloseableExecutorService is closed");

//JAVA TO C# CONVERTER TODO TASK: Java wildcard generics are not converted to .NET:
//ORIGINAL LINE: java.util.concurrent.ScheduledFuture<?> scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(task, initialDelay, delay, unit);
            ScheduledFuture < ? >
            scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(task, initialDelay, delay, unit);
            return new InternalScheduledFutureTask(this, scheduledFuture);
        }
开发者ID:shayhatsor,项目名称:curator,代码行数:10,代码来源:CloseableScheduledExecutorService.cs


示例15: Thread

		Thread (Runnable runnable, ThreadGroup grp, string name)
		{
			thread = new System.Threading.Thread (new ThreadStart (InternalRun));
			
			this.runnable = runnable ?? this;
			tgroup = grp ?? defaultGroup;
			tgroup.Add (this);
			if (name != null)
				thread.Name = name;
		}
开发者ID:hazzik,项目名称:Sharpen.Runtime,代码行数:10,代码来源:Thread.cs


示例16: Execute

			// An Executor that can be used to execute tasks in parallel.
			// An Executor that executes tasks one at a time in serial order.  This
			// serialization is global to a particular process.
			public virtual void Execute(Runnable r)
			{
				lock (this)
				{
					mTasks.Offer(new _Runnable_58(this, r));
					if (mActive == null)
					{
						ScheduleNext();
					}
				}
			}
开发者ID:Redth,项目名称:couchbase-lite-net,代码行数:14,代码来源:BackgroundTask.cs


示例17: PostQueue

        private void PostQueue(Runnable runnable)
        {
            lock (mQueue)
            {
                mQueue.Enqueue(runnable);
            }

            if (!IsNotify)
            {
                IsNotify = true;

                Task task = new Task(Run);
                task.Start();
            }
        }
开发者ID:guogongjun,项目名称:Blink,代码行数:15,代码来源:CallBackDelivery.cs


示例18: Submit

 /**
  * Submit a runnable task to the executor.
  */
 public void Submit(Runnable task) {
     Logger.Trace("Submit(task={})", task);
     // Synchronise on the queue lock...
     lock(queueLock) {
         // Sanity check before adding the task
         if(!shutdownRequested) {
             // Enqueue the new runnable task
             queue.Enqueue(task);
             // Fire a notification to the synchronisation object to notify any waiters
             Logger.Trace("Notify queue of new task...");
             Monitor.Pulse(queueLock);
             Logger.Trace("...notified queue of new task.");
         }
         else {
             throw new InvalidOperationException("Can not submit a task when the queue has been shut down");
         }
     }
 }
开发者ID:seipekm,项目名称:MonoBrick-Communication-Software,代码行数:21,代码来源:SingleThreadExecutor.cs


示例19: InternalExecute

		internal void InternalExecute (Runnable r, bool checkShutdown)
		{
			lock (pendingTasks) {
				if (shutdown && checkShutdown)
					throw new InvalidOperationException ();
				if (runningThreads < corePoolSize) {
					StartPoolThread ();
				}
				else if (freeThreads > 0) {
					freeThreads--;
				}
				else if (runningThreads < maxPoolSize) {
					StartPoolThread ();
				}
				pendingTasks.Enqueue (r);
				ST.Monitor.PulseAll (pendingTasks);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:18,代码来源:ThreadPoolExecutor.cs


示例20: CheckException

 protected static void CheckException(Runnable callbk, string name, string msg)
 {
     try
     {
       callbk();
       LogMessage(msg + ": CheckException failure: no exception detected");
       Environment.Exit(1);
     }
     catch(Exception e)
     {
       if(!e.GetType().Name.Equals(name))
       {
     LogMessage(msg + ": CheckException failure: wrong exception type");
     LogMessage("Expected: " + name);
     LogMessage("Actual: " + e.GetType().Name);
     Environment.Exit(1);
       }
     }
 }
开发者ID:possientis,项目名称:Prog,代码行数:19,代码来源:Test_Abstract.cs



注:本文中的Runnable类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Runner类代码示例发布时间:2022-05-24
下一篇:
C# RunWorkerCompletedEventHandler类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap