TsgcWebSocketServer › Properties › ThreadPool
Enables a thread pool that recycles worker threads instead of destroying them when connections close.
public bool ThreadPool { get; set; }
False
When ThreadPool is True, threads that finish serving a connection are returned to a pool instead of being destroyed; they are marked inactive and consume no CPU cycles until reused, which dramatically reduces the cost of short-lived connections. Tune ThreadPoolOptions (MaxThreads, PoolSize) to control how many threads may be created. The thread pool is not compatible with IOCP: do not enable both ThreadPool and IOHandlerOptions.IOHandler=iohIOCP at the same time.
oServer = new TsgcWebSocketServer();
oServer.ThreadPool = true;
oServer.ThreadPoolOptions.PoolSize = 32;
oServer.Active = true;