Commit 64e87e12 authored by Kai Vehmanen's avatar Kai Vehmanen

Updated patch to the glib integration from Mikhail Zabaluev. Closes #1606786.

darcs-hash:20061229162452-7659e-5a9c5663cfbee131dfda0c04f30c80d55874a83f.gz
parent 570b1289
...@@ -989,26 +989,27 @@ su_duration_t su_source_step(su_port_t *self, su_duration_t tout) ...@@ -989,26 +989,27 @@ su_duration_t su_source_step(su_port_t *self, su_duration_t tout)
gmc = g_source_get_context(self->sup_source); gmc = g_source_get_context(self->sup_source);
if (gmc && g_main_context_acquire(gmc)) { if (gmc && g_main_context_acquire(gmc)) {
gint n = 0;
GPollFD *fds = NULL; GPollFD *fds = NULL;
gint fds_size = 0;
gint fds_wait;
gint priority = G_MAXINT; gint priority = G_MAXINT;
gint src_tout = -1;
if (g_main_context_prepare(gmc, &priority)) { g_main_context_prepare(gmc, &priority);
gint src_tout = -1;
n = g_main_context_query(gmc, priority, &src_tout, NULL, 0); fds_wait = g_main_context_query(gmc, priority, &src_tout, NULL, 0);
if (n > 0) { while (fds_wait > fds_size) {
fds = g_alloca(n * (sizeof *fds)); fds = g_alloca(fds_wait * sizeof(fds[0]));
n = g_main_context_query(gmc, priority, &src_tout, fds, n); fds_size = fds_wait;
} fds_wait = g_main_context_query(gmc, priority, &src_tout, fds, fds_size);
}
if (src_tout >= 0 && tout > (su_duration_t)src_tout) if (src_tout >= 0 && tout > (su_duration_t)src_tout)
tout = src_tout; tout = src_tout;
su_wait((su_wait_t *)fds, n, tout); su_wait((su_wait_t *)fds, fds_wait, tout);
}
g_main_context_check(gmc, priority, fds, n); g_main_context_check(gmc, priority, fds, fds_wait);
g_main_context_dispatch(gmc); g_main_context_dispatch(gmc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment