mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 07:26:15 +01:00
tests: Move some global variables into local scope in thread-pool-slow
This makes things a bit more maintainable, as there’s less global state to worry about. It introduces no functional changes. Signed-off-by: Philip Withnall <philip@tecnocode.co.uk>
This commit is contained in:
parent
f0dbf6fe7c
commit
1195a7a638
@ -16,10 +16,6 @@ static gulong abs_thread_counter = 0;
|
||||
static gulong running_thread_counter = 0;
|
||||
static gulong leftover_task_counter = 0;
|
||||
|
||||
G_LOCK_DEFINE_STATIC (last_thread);
|
||||
|
||||
static guint last_thread_id = 0;
|
||||
|
||||
static GThreadPool *idle_pool = NULL;
|
||||
|
||||
static GMainLoop *main_loop = NULL;
|
||||
@ -203,8 +199,10 @@ test_thread_sort_entry_func (gpointer data, gpointer user_data)
|
||||
{
|
||||
guint thread_id;
|
||||
gboolean is_sorted;
|
||||
static GMutex last_thread_mutex;
|
||||
static guint last_thread_id = 0;
|
||||
|
||||
G_LOCK (last_thread);
|
||||
g_mutex_lock (&last_thread_mutex);
|
||||
|
||||
thread_id = GPOINTER_TO_UINT (data);
|
||||
is_sorted = GPOINTER_TO_INT (user_data);
|
||||
@ -217,7 +215,7 @@ test_thread_sort_entry_func (gpointer data, gpointer user_data)
|
||||
last_thread_id = thread_id;
|
||||
}
|
||||
|
||||
G_UNLOCK (last_thread);
|
||||
g_mutex_unlock (&last_thread_mutex);
|
||||
|
||||
g_usleep (WAIT * 1000);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user