added windows support to functions in thread.c