[aravis] gv_device: avoid eating all the cpu in heartbeat thread if we lose control access.



commit b601d479b7c321afe1efed8219f7ed8f297a14e3
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sun May 15 00:34:55 2011 +0200

    gv_device: avoid eating all the cpu in heartbeat thread if we lose control access.

 src/arvgvdevice.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/arvgvdevice.c b/src/arvgvdevice.c
index a7e0ea0..512a655 100644
--- a/src/arvgvdevice.c
+++ b/src/arvgvdevice.c
@@ -337,13 +337,14 @@ arv_gv_device_heartbeat_thread (void *data)
 	guint32 value;
 
 	do {
+		g_usleep (thread_data->period_us);
+
 		if (io_data->is_controller) {
 
 			/* TODO: Instead of reading the control register, Pylon does write the heartbeat
 			 * timeout value, which is interresting, as doing this we could get an error
 			 * ack packet which will indicate we lost the control access. */
 
-			g_usleep (thread_data->period_us);
 			_read_register (io_data, ARV_GVBS_CONTROL_CHANNEL_PRIVILEGE_OFFSET, &value);
 			arv_log_device ("[GvDevice::Heartbeat] (%d)", value);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]