3 static GMainLoop *loop;
6 stop_waiting (gpointer data)
8 g_main_loop_quit (loop);
14 function (gpointer data)
16 g_assert_not_reached ();
22 /* Bug 642052 mentions that g_timeout_add_seconds(21475) schedules a
23 * job that runs once per second.
25 * Test that that isn't true anymore by scheduling two jobs:
27 * - another that runs in 2100ms
29 * If everything is working properly, the 2100ms one should run first
30 * (and exit the mainloop). If we ever see the 21475 second job run
31 * then we have trouble (since it ran in less than 2 seconds).
33 * We need a timeout of at least 2 seconds because
34 * g_timeout_add_second can add as much as an additional second of
37 loop = g_main_loop_new (NULL, FALSE);
39 g_timeout_add (2100, stop_waiting, NULL);
40 g_timeout_add_seconds (21475, function, NULL);
42 g_main_loop_run (loop);
46 main (int argc, char *argv[])
48 g_test_init (&argc, &argv, NULL);
50 g_test_add_func ("/timeout/seconds", test_seconds);