From 8b369f263f10de056c3633806a7f1ed87e2b7145 Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Wed, 17 Oct 2012 08:15:39 -0400 Subject: init threading properly, added more mutex locks --- error_utils.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'error_utils.c') diff --git a/error_utils.c b/error_utils.c index d4c48a3..bb2cd32 100644 --- a/error_utils.c +++ b/error_utils.c @@ -528,13 +528,16 @@ void get_error_text(gchar **response, int error_num) int Error_check(ChannelStruct ChannelStateToTest[max_channels]) { + static GStaticMutex mutex = G_STATIC_MUTEX_INIT; + g_static_mutex_lock (&mutex); float max_duty_high_ampl,max_duty_low_ampl,max_duty_this_ampl; float ampl_fixed_max_duty; float temp; float duty_scale; float duty_cycle; - int report_error; + int report_error = OK; + gboolean early_quit = FALSE; int i; int num_of_chan; @@ -640,29 +643,33 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) } - report_error=OK; - - for (i=0; i0.0) { - return pw_lower_limit; + early_quit = TRUE; + report_error = pw_lower_limit; + break; } /* calculate maximum duty cycle based on amplitude and load, for later use */ @@ -1421,6 +1428,8 @@ int Error_check(ChannelStruct ChannelStateToTest[max_channels]) /* --- done all per-channel checking ---- */ } + g_static_mutex_unlock (&mutex); + return report_error; } -- cgit