public void AddSource(SourceFunction sf) { if (sf != null) { try { sf.Init(); } catch (Exception ex) { Logger.Log.Error(true, "SourceFuntion:", ex); } sf.Context = new SourceContext(); sf.Context.CollectHandler += SourceFunction_CollectHandler; Thread thread = new Thread(new ParameterizedThreadStart(sf.Run)); thread.IsBackground = true; thread.Name = "SourceFunction:" + sf.GetHashCode().ToString(); SourceFunctionThread sourceFunctionThread = new SourceFunctionThread(sf, thread); SourceFunctionThreads.Add(sourceFunctionThread); } }