Is there a portable way to count running threads

I want to count the number of running threads. In Linux, this could be done by counting the entries in /proc/[pid]/task/. I assume there is some c-based lib, but I could not find that.
Is there any portable way to get this information? Supporting windows & unix only is fine.

There is, but it doesn't support Windows, so I don't know whether it's possible at all.