本帖最后由 liuke2012 于 2010-07-31 10:12:11 编辑

解决方案 »

  1.   

    你看看匹配时的cpu占用率,如果占用率不高,考虑用多线程找。
      

  2.   


    class Program
    {
        public delegate void PurportMatchEventHandler(int i);
        public static event PurportMatchEventHandler PurportMatched;
        static void Main(string[] args)
        {
            int ncpu = Environment.ProcessorCount;
            int part = 2000 / ncpu;/*指纹个数/cpu个数*/
            if (ncpu > 1)
            {
                bool found = false;                
                Thread[] threads = new Thread[ncpu - 1];//每个cpu分配一个线程
                for (int i = 0; i < threads.Length; i++)
                {
                    threads[i] = new Thread((ParameterizedThreadStart)delegate(object par)
                        {
                            int start = (int)par;
                            for (int index = start * part; index < (start + 1) * part; i++)
                            {
                                //查找
                                bool thisfound = Verify(index,..);//你的查找方法
                                if(thisfound)
                                {
                                    found = thisfound;
                                    if(PurportMatched!=null)PurportMatched(index);//事件通知出去。外面注册事件。
                                }
                                if (found) return;//停止线程,所有线程都会用这个标记停止自己
                            }
                        });
                    threads[i].Start();
                }
            }
            else
            {
            }
          
            Console.ReadKey();
        }
    }按你需求写的例子。尽量自己看明白加到你系统中。看不懂的msdn
      

  3.   

    如果是单核cpu,用多线程是不是就没用了?
      

  4.   

    现在指纹大约有2000个,保存在List<UserFingerPrintTemplate>里面.尽量把2000个员工分类,把经常要指纹匹配的人员尽量排在前面啊