Add support for threadnames on BSD, Windows (MSVC-only), and OSX

Tested only on Linux currently...