redo thread priority

I previously reverted pull #517 because the added unittest failed on FreeBSD.
This is a redone with a fixed unittest.

NB:
On FreeBSD the underlying system calls for the Thread.priority property fail with dead threads.