From 4188c7d8e726fd333b5860cda8194ac62a9442dd Mon Sep 17 00:00:00 2001 From: "B.Prathibha" Date: Sun, 27 Jan 2013 12:43:28 +0530 Subject: [PATCH] Reduce wakeups to save power Use g_timeout_add_seconds instead of g_timeout_add to reduce the no. of wakeups. --- examples/client/extended-client.c | 2 +- telepathy-glib/base-media-call-content.c | 4 ++-- telepathy-glib/run.c | 6 +++--- tests/dbus/account-manager.c | 6 +++--- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/examples/client/extended-client.c b/examples/client/extended-client.c index 8572b63..199416f 100644 --- a/examples/client/extended-client.c +++ b/examples/client/extended-client.c @@ -307,7 +307,7 @@ main (int argc, g_signal_connect (cm, "got-info", G_CALLBACK (connection_manager_got_info), NULL); - timer = g_timeout_add (5000, time_out, NULL); + timer = g_timeout_add_seconds (5, time_out, NULL); g_main_loop_run (mainloop); diff --git a/telepathy-glib/base-media-call-content.c b/telepathy-glib/base-media-call-content.c index 6256c06..1008e26 100644 --- a/telepathy-glib/base-media-call-content.c +++ b/telepathy-glib/base-media-call-content.c @@ -73,7 +73,7 @@ #include "telepathy-glib/util.h" #include "telepathy-glib/util-internal.h" -#define DTMF_PAUSE_MS (3000) +#define DTMF_PAUSE_MS (3) static void call_content_media_iface_init (gpointer, gpointer); @@ -1123,7 +1123,7 @@ tp_base_media_call_content_dtmf_next (TpBaseMediaCallContent *self) self->priv->current_dtmf_state); break; case DTMF_CHAR_CLASS_PAUSE: - self->priv->tones_pause_timeout_id = g_timeout_add ( + self->priv->tones_pause_timeout_id = g_timeout_add_seconds ( DTMF_PAUSE_MS, dtmf_pause_timeout_func, self); tp_svc_call_content_interface_dtmf_emit_sending_tones (self, self->priv->currently_sending_tones); diff --git a/telepathy-glib/run.c b/telepathy-glib/run.c index 7ae6e82..f135456 100644 --- a/telepathy-glib/run.c +++ b/telepathy-glib/run.c @@ -101,7 +101,7 @@ new_connection (TpBaseConnectionManager *conn, } } -#define DIE_TIME 5000 +#define DIE_TIME 5 static void no_more_connections (TpBaseConnectionManager *conn) @@ -113,7 +113,7 @@ no_more_connections (TpBaseConnectionManager *conn) g_source_remove (timeout_id); } - timeout_id = g_timeout_add (DIE_TIME, kill_connection_manager, NULL); + timeout_id = g_timeout_add_seconds (DIE_TIME, kill_connection_manager, NULL); } #ifdef ENABLE_BACKTRACE @@ -280,7 +280,7 @@ tp_run_connection_manager (const char *prog_name, g_debug ("started version %s (telepathy-glib version %s)", version, VERSION); - timeout_id = g_timeout_add (DIE_TIME, kill_connection_manager, NULL); + timeout_id = g_timeout_add_seconds (DIE_TIME, kill_connection_manager, NULL); g_main_loop_run (mainloop); diff --git a/tests/dbus/account-manager.c b/tests/dbus/account-manager.c index 22de1c5..113fe7b 100644 --- a/tests/dbus/account-manager.c +++ b/tests/dbus/account-manager.c @@ -121,7 +121,7 @@ script_start_with_deadline (Test *test, guint timeout) { script_append_action (test, quit_action, NULL); - test->timeout_id = g_timeout_add (timeout, test_timed_out, test); + test->timeout_id = g_timeout_add_seconds (timeout, test_timed_out, test); script_continue (test); g_main_loop_run (test->mainloop); } @@ -201,7 +201,7 @@ static void teardown_service (Test *test, gconstpointer data) { - script_start_with_deadline (test, 1000); + script_start_with_deadline (test, 1); g_assert ( tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME, &test->error)); @@ -508,7 +508,7 @@ test_prepare_no_name (Test *test, script_append_action (test, assert_failed_action, NULL); /* Since we are using teardown rather than teardown_service, we need to * run the script ourselves */ - script_start_with_deadline (test, 1000); + script_start_with_deadline (test, 1); } /** -- 1.7.10.4