Make TaskScheduler::WaitForTerminateCompletion() platform-independent.
Create TaskScheduler::CountThreadsPerPid() method in both Linux and FreeBSD
implementations, to chceck if all threads exited for a given PID.
This solves an issue on FreeBSD, where tests hanged after passing.

Change-Id: I2467ce697fd97e7b0a7a38e70164e2ea9ae2dda1
Merge "Make TaskScheduler::WaitForTerminateCompletion() platform-independent. Create TaskScheduler::CountThreadsPerPid() method in both Linux and FreeBSD implementations, to chceck if all threads exited for a given PID. This solves an issue on FreeBSD, where tests hanged after passing."