+
+ if (!rc) {
+ struct thread_ctx *ctx;
+ struct windowsaio_data *wd;
+ HANDLE hFile;
+
+ hFile = CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, 0, 0);
+ if (hFile == INVALID_HANDLE_VALUE)
+ rc = 1;
+
+ wd = td->io_ops->data;
+ wd->iothread_running = TRUE;
+ wd->iocp = hFile;
+
+ if (!rc)
+ ctx = malloc(sizeof(struct thread_ctx));
+
+ if (!rc && ctx == NULL)
+ {
+ log_err("fio: out of memory in windowsaio\n");
+ CloseHandle(hFile);
+ rc = 1;
+ }
+
+ if (!rc)
+ {
+ ctx->iocp = hFile;
+ ctx->wd = wd;
+ wd->iothread = CreateThread(NULL, 0, IoCompletionRoutine, ctx, 0, NULL);
+ }
+
+ if (rc || wd->iothread == NULL)
+ rc = 1;
+ }
+