码迷,mamicode.com
首页 >  
搜索关键字:threading    ( 3244个结果
QuickSort(.net)
using System; using System.Collections.Generic;   using System.Linq;   using System.Text;   using System.Threading;   using System.Diagnostics;   namespace _...
分类:Web程序   时间:2014-12-05 19:28:04    阅读次数:207
C#多线程 为多核处理器而生的多线程方法Parallel.For和Parallel.ForEach
1.在.net4.0中,有了一个新的类库:任务并行库。它极大地简化了并行编程且内容丰富。这里仅介绍其中最简单的 Parallel.For循环和Parallel.ForEach循环。它们位于System.Threading.Tasks命名空间。它们是两个方法,这两个方法将迭代分别放在不同的处理器上并行处理,如果机器是多处理器或多核处理器,这样就会使性能大大提升。 2.例子用Parallel....
分类:编程语言   时间:2014-12-05 14:21:56    阅读次数:272
使用 Task 替换 ThreadPool ,异步监测所有线程(任务)是否全部执行完毕
判断线程池中线程是否全部执行完成的问题? using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace Ex.RulesTester.Threads ...
分类:编程语言   时间:2014-12-05 12:53:46    阅读次数:159
C#多线程 定时重复调用异步线程即System.Threading.Timer类使用小例
1.System.Threading.Timer计时器提供了一种重复调用异步线程的方法。.Net BCL中有多个Timer类,如用于Windows应用程序的System.Windows.Forms.Timer类,如可以运行在用户接口线程或工作线程上的System.Timers.Timer类。它们是很不一样的,这里要讲的System.Threading.Timer类是一种定时调用某个异步线程的类。每...
分类:编程语言   时间:2014-12-05 12:52:13    阅读次数:180
基于socket的客户端和服务端聊天机器人
服务端代码如下:using System;using System.Net;using System.Net.Sockets;using System.Text;using System.Threading;using System.Windows.Forms;namespace Client{ ....
分类:其他好文   时间:2014-12-05 12:31:48    阅读次数:310
C# 实现程序只启动一次(实现程序自重启)
程序运行过程中,不能有多个实例运行,并且需要程序自己可以重启(重新运行),所以代码如果下代码:static void Main() { bool createNew; using (System.Threading.Mutex m = new System.Threading.Mut...
分类:Windows程序   时间:2014-12-02 22:18:25    阅读次数:465
猜数字小游戏(创建一个控制台。。。原理:random 产生随机数)
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace eluosi{ class Program { stati...
分类:其他好文   时间:2014-11-30 21:25:03    阅读次数:158
彩色控制台(随机random)
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace eluosi{ class Program { stati...
分类:其他好文   时间:2014-11-30 21:19:41    阅读次数:142
线程暂停。
using System; using System.Text;using System.Windows.Forms;using System.Threading;namespace WindowsApplication1{ public partial class Form1 : Form { ....
分类:编程语言   时间:2014-11-29 10:21:01    阅读次数:146
c# 内部类使用接口IComparer实现排序
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 内部类使用接口实现排序{ class Person ...
分类:编程语言   时间:2014-11-29 00:15:56    阅读次数:174
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!