I am writing a C++ program on Solaris platform. The program continuously spawns worker threads for handling requests. Somehow the program has to detect OS congestion (high CPU, reached max usage limit or something like that) so that it could slow down handling requests and stop spawning new threads until congestion has gone. Please let me know whether it is possible.
I appreciate your help.