e->source = g_timeout_source_new(msec_diff(tv, &now));
assert(e->source);
g_source_set_callback(e->source, time_cb, e, NULL);
- g_source_set_priority(e->source, G_PRIORITY_HIGH);
+ g_source_set_priority(e->source, G_PRIORITY_DEFAULT);
g_source_attach(e->source, e->mainloop->glib_main_context);
} else
e->source = NULL;
assert(e->source);
g_source_set_callback(e->source, idle_cb, e, NULL);
g_source_attach(e->source, e->mainloop->glib_main_context);
- g_source_set_priority(e->source, G_PRIORITY_HIGH_IDLE);
+ g_source_set_priority(e->source, G_PRIORITY_HIGH);
}
}
#include <sys/time.h>
#include <assert.h>
-/*#define GLIB_MAIN_LOOP*/
+#define GLIB_MAIN_LOOP
#ifdef GLIB_MAIN_LOOP
#include <glib.h>
#include "mainloop.h"
#endif
+static struct pa_defer_event *de;
+
static void iocb(struct pa_mainloop_api*a, struct pa_io_event *e, int fd, enum pa_io_event_flags f, void *userdata) {
unsigned char c;
read(fd, &c, sizeof(c));
fprintf(stderr, "IO EVENT: %c\n", c < 32 ? '.' : c);
+ a->defer_enable(de, 1);
}
static void dcb(struct pa_mainloop_api*a, struct pa_defer_event *e, void *userdata) {
int main(int argc, char *argv[]) {
struct pa_mainloop_api *a;
struct pa_io_event *ioe;
- struct pa_defer_event *de;
struct pa_time_event *te;
struct timeval tv;