windows: Fix deadlock in error case in message pump thread creation
windows: Destroy USB poller thread in event_run_platform as it was also created there
Remove unnecessary variable
macosx: Fix deadlock in error case in IOKit poll thread creation

Also join poll thread on exit, instead of only waiting for the stopped
semaphore, because there is cleanup code after the stopped semaphore
is released.
Add MAX_LOG_CATEGORIES to simplify code and make adding new categories less error prone