OS-specific thread implementation - stopping a thread