How to limit thread creation using setrlimit

I would like to know how to use setrlimit (with the resource RLIMIT_NTHR) or any other function to limit thread creation.

Also, i want to know if there is any function or unix command to limit OMOSTickTimer thread creation.