public static bool Start(int port, int nThreads = 64) { threadPool = new SimpleLockThreadPool(nThreads); Listener = new TcpListener(System.Net.IPAddress.Any, port); listenerThread = new Thread(ListenProc); Listener.Start(); listenerThread.Start(); return(true); }
public void TestThreadPool() { SimpleLockThreadPool pool = new SimpleLockThreadPool(64); context curr = new context(); for (int i = 0; i < 10; i++) { curr = new context(); curr.processNumber = i; pool.QueueUserWorkItem(ThreadWorkTest, curr); } pool.Dispose(); }