Fix DEBUG_THREADS on FreeBSD

There was a typo in an #include, furthermore FreeBSD has no
pthread_getname_np equivalent.

I added Sys_GetThreadName() so the code is a bit cleaner.