174
_g_win32_overlap_wait_result (HANDLE hfile,
177
GCancellable *cancellable)
180
gboolean result = FALSE;
183
pollfd[0].fd = (gint)overlap->hEvent;
184
pollfd[0].events = G_IO_IN;
187
if (g_cancellable_make_pollfd (cancellable, &pollfd[1]))
191
npoll = g_poll (pollfd, num, -1);
193
/* error out, should never happen */
196
if (g_cancellable_is_cancelled (cancellable))
198
/* CancelIO only cancels pending operations issued by the
199
* current thread and since we're doing only sync operations,
200
* this is safe.... */
201
/* CancelIoEx is only Vista+. Since we have only one overlap
202
* operaton on this thread, we can just use: */
203
result = CancelIo (hfile);
204
g_warn_if_fail (result);
207
result = GetOverlappedResult (overlap->hEvent, overlap, transferred, FALSE);
208
if (result == FALSE &&
209
GetLastError () == ERROR_IO_INCOMPLETE &&
210
!g_cancellable_is_cancelled (cancellable))
215
g_cancellable_release_fd (cancellable);