Use in-band thread IDs, since the libraries seem not to be reliable.

This is a fix for issue #8.