Use g_cancellable_release_fd()

Part of: Bug 591388 - number of GCancellables available is too limited
This commit is contained in:
Benjamin Otte 2009-08-11 15:12:20 +02:00
parent e2c97292c2
commit faae032ad0
3 changed files with 12 additions and 2 deletions

View File

@ -2255,7 +2255,10 @@ winsock_finalize (GSource *source)
g_object_unref (socket); g_object_unref (socket);
if (winsock_source->cancellable) if (winsock_source->cancellable)
g_object_unref (winsock_source->cancellable); {
g_cancellable_release_fd (winsock_source->cancellable);
g_object_unref (winsock_source->cancellable);
}
} }
static GSourceFuncs winsock_funcs = static GSourceFuncs winsock_funcs =
@ -2470,6 +2473,8 @@ g_socket_condition_wait (GSocket *socket,
current_condition = update_condition (socket); current_condition = update_condition (socket);
} }
remove_condition_watch (socket, &condition); remove_condition_watch (socket, &condition);
if (num_events > 1)
g_cancellable_release_fd (cancellable);
return (condition & current_condition) != 0; return (condition & current_condition) != 0;
} }
@ -2490,6 +2495,9 @@ g_socket_condition_wait (GSocket *socket,
result = g_poll (poll_fd, num, -1); result = g_poll (poll_fd, num, -1);
while (result == -1 && get_socket_errno () == EINTR); while (result == -1 && get_socket_errno () == EINTR);
if (num > 1)
g_cancellable_release_fd (cancellable);
return cancellable == NULL || return cancellable == NULL ||
!g_cancellable_set_error_if_cancelled (cancellable, error); !g_cancellable_set_error_if_cancelled (cancellable, error);
} }

View File

@ -347,6 +347,7 @@ g_unix_input_stream_read (GInputStream *stream,
do do
poll_ret = g_poll (poll_fds, 2, -1); poll_ret = g_poll (poll_fds, 2, -1);
while (poll_ret == -1 && errno == EINTR); while (poll_ret == -1 && errno == EINTR);
g_cancellable_release_fd (cancellable);
if (poll_ret == -1) if (poll_ret == -1)
{ {

View File

@ -333,6 +333,7 @@ g_unix_output_stream_write (GOutputStream *stream,
do do
poll_ret = g_poll (poll_fds, 2, -1); poll_ret = g_poll (poll_fds, 2, -1);
while (poll_ret == -1 && errno == EINTR); while (poll_ret == -1 && errno == EINTR);
g_cancellable_release_fd (cancellable);
if (poll_ret == -1) if (poll_ret == -1)
{ {