Fixed the way thread-stack information is retrieved on BSD.

As requested, I made the same changes as in commit 7cf0039 to the pthread calls for getting information about the thread stack (e.g., stack size).