Add JoinThread function to enable thread cleanup.

I was researching an approximately 15 MB memory leak on Linux with tsmf gstreamer (per video playback), and found that pthread_join is not currently in use.  Per the notes on the pthread_create manpage, pthread_join must be called for the cleanup to be performed.  This JoinThread function is my suggested API to enable this functionality.

This does not add calls yet to the function to actually perform the
cleanup.  This is untested on Windows.