Skip to content
Snippets Groups Projects
Commit a060b849 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#3902] Relax async calls on gdk_main_loop in multithreads

parent 3f5a3720
Branches
Tags
No related merge requests found
...@@ -177,10 +177,11 @@ void threaded_clock_incrementer (void *pc) ...@@ -177,10 +177,11 @@ void threaded_clock_incrementer (void *pc)
calltree_update_clock(); calltree_update_clock();
} }
// gdk_flush();
gdk_threads_leave (); gdk_threads_leave ();
usleep (10000); usleep (1000000);
} }
......
...@@ -61,7 +61,8 @@ GtkWidget * filterEntry = NULL; ...@@ -61,7 +61,8 @@ GtkWidget * filterEntry = NULL;
PidginScrollBook *embedded_error_notebook; PidginScrollBook *embedded_error_notebook;
gchar *status_current_message = NULL; gchar *status_current_message = NULL;
pthread_mutex_t statusbar_message_mutex; // pthread_mutex_t statusbar_message_mutex;
GMutex *gmutex;
/** /**
* Handle main window resizing * Handle main window resizing
...@@ -96,7 +97,8 @@ on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED) ...@@ -96,7 +97,8 @@ on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED)
sflphone_quit (); sflphone_quit ();
} }
pthread_mutex_destroy (&statusbar_message_mutex); // pthread_mutex_destroy (&statusbar_message_mutex);
g_mutex_free (gmutex);
return TRUE; return TRUE;
} }
...@@ -294,7 +296,8 @@ create_main_window () ...@@ -294,7 +296,8 @@ create_main_window ()
/* don't show waiting layer */ /* don't show waiting layer */
gtk_widget_hide (waitingLayer); gtk_widget_hide (waitingLayer);
pthread_mutex_init (&statusbar_message_mutex, NULL); // pthread_mutex_init (&statusbar_message_mutex, NULL);
gmutex = g_mutex_new();
// Configuration wizard // Configuration wizard
if (account_list_get_size () == 1) { if (account_list_get_size () == 1) {
...@@ -407,7 +410,8 @@ statusbar_push_message (const gchar *left_hand_message, const gchar *right_hand_ ...@@ -407,7 +410,8 @@ statusbar_push_message (const gchar *left_hand_message, const gchar *right_hand_
// The actual message to be push in the statusbar // The actual message to be push in the statusbar
gchar *message_to_display; gchar *message_to_display;
pthread_mutex_lock (&statusbar_message_mutex); g_mutex_lock (gmutex);
// pthread_mutex_lock (&statusbar_message_mutex);
g_free (status_current_message); g_free (status_current_message);
// store the left hand message so that it can be reused in case of clock update // store the left hand message so that it can be reused in case of clock update
...@@ -425,7 +429,8 @@ statusbar_push_message (const gchar *left_hand_message, const gchar *right_hand_ ...@@ -425,7 +429,8 @@ statusbar_push_message (const gchar *left_hand_message, const gchar *right_hand_
g_free (message_to_display); g_free (message_to_display);
pthread_mutex_unlock (&statusbar_message_mutex); // pthread_mutex_unlock (&statusbar_message_mutex);
g_mutex_unlock (gmutex);
} }
void void
...@@ -445,9 +450,11 @@ statusbar_update_clock (gchar *msg) ...@@ -445,9 +450,11 @@ statusbar_update_clock (gchar *msg)
} }
pthread_mutex_lock (&statusbar_message_mutex); // pthread_mutex_lock (&statusbar_message_mutex);
g_mutex_lock (gmutex);
message = g_strdup (status_current_message); message = g_strdup (status_current_message);
pthread_mutex_unlock (&statusbar_message_mutex); // pthread_mutex_unlock (&statusbar_message_mutex);
g_mutex_unlock (gmutex);
if (message) { if (message) {
statusbar_pop_message (__MSG_ACCOUNT_DEFAULT); statusbar_pop_message (__MSG_ACCOUNT_DEFAULT);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment