+#ifdef WIN32
+ /* we create a wrapper on windows and pass yaz_thread struct to that */
+ unsigned threadID;
+ uintptr_t ex_ret;
+ t->data = arg; /* use data for both input and output */
+ t->routine = start_routine;
+ ex_ret = _beginthreadex(NULL, 0, win32_routine, t, 0, &threadID);
+ if (ex_ret == -1L)
+ {
+ xfree(t);
+ t = 0;
+ }
+ t->handle = (HANDLE) ex_ret;
+#else
+ t->data = start_routine(arg);
+#endif