Changes to windows compilation and some errors with pthread timed wait.