mswin_printer_fclose(gx_io_device * iodev, gp_file * file)
{
    uintptr_t *ptid = &((tid_t *)(iodev->state))->tid;
    HANDLE hthread;
    gp_fclose(file);
    if (*ptid != -1) {
        /* Wait until the print thread finishes before continuing */
        hthread = (HANDLE)*ptid;
        WaitForSingleObject(hthread, 60000);
        CloseHandle(hthread);
        *ptid = -1;
    }
    return 0;
}
mswin_printer_fclose(gx_io_device * iodev, gp_file * file)
{
    uintptr_t *ptid = &((tid_t *)(iodev->state))->tid;
    HANDLE hthread;
    gp_fclose(file);
    if (*ptid != -1) {
         
        hthread = (HANDLE)*ptid;
        WaitForSingleObject(hthread, 60000);
        CloseHandle(hthread);
        *ptid = -1;
    }
    return 0;
}