while (true) { Thread.Sleep(sleepTime); if (clientList.Count >= config.maxThread) continue; doQuery(config.maxThread - clientList.Count); }