Fix threading for Windows

See title.