implement setThreadAffinity on Windows (#1741)