diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-10-13 06:22:29 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2009-10-13 06:22:29 +0000 |
commit | 996fee475e501a991ff04548abf1d9a5ff311d89 (patch) | |
tree | 56edd44200c14b391bec6fae772a53f8cf362ac3 /libsylph | |
parent | 9442a550896bbc164a13c8e2f25d9674ca86fd2a (diff) |
use g_atomic_int_{get,set} for thread terminate flags.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2282 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/imap.c | 6 | ||||
-rw-r--r-- | libsylph/socket.c | 4 | ||||
-rw-r--r-- | libsylph/utils.c | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/libsylph/imap.c b/libsylph/imap.c index 198bbc72..129c0485 100644 --- a/libsylph/imap.c +++ b/libsylph/imap.c @@ -4775,7 +4775,7 @@ static void imap_thread_run_proxy(gpointer push_data, gpointer data) g_print("imap_thread_run_proxy (%p): calling thread_func\n", g_thread_self()); real->retval = real->thread_func(IMAP_SESSION(real), real->thread_data); - real->flag = 1; + g_atomic_int_set(&real->flag, 1); g_print("imap_thread_run_proxy (%p): thread_func done\n", g_thread_self()); g_main_context_wakeup(NULL); } @@ -4806,7 +4806,7 @@ static gint imap_thread_run(IMAPSession *session, IMAPThreadFunc func, g_thread_pool_push(real->pool, real, NULL); - while (real->flag == 0) + while (g_atomic_int_get(&real->flag) == 0) event_loop_iterate(); real->is_running = FALSE; @@ -4850,7 +4850,7 @@ static gint imap_thread_run_progress(IMAPSession *session, IMAPThreadFunc func, g_thread_pool_push(real->pool, real, NULL); - while (real->flag == 0) { + while (g_atomic_int_get(&real->flag) == 0) { event_loop_iterate(); if (prev_count != real->prog_count && real->prog_total > 0) { progress_func(session, real->prog_count, diff --git a/libsylph/socket.c b/libsylph/socket.c index 47aa7ec1..566d940b 100644 --- a/libsylph/socket.c +++ b/libsylph/socket.c @@ -1332,7 +1332,7 @@ static gpointer sock_connect_async_func(gpointer data) SockConnectData *conn_data = (SockConnectData *)data; conn_data->sock = sock_connect(conn_data->hostname, conn_data->port); - conn_data->flag = 1; + g_atomic_int_set(&conn_data->flag, 1); debug_print("sock_connect_async_func: connected\n"); g_main_context_wakeup(NULL); @@ -1382,7 +1382,7 @@ gint sock_connect_async_thread_wait(gint id, SockInfo **sock) } debug_print("sock_connect_async_thread_wait: waiting thread\n"); - while (conn_data->flag == 0) + while (g_atomic_int_get(&conn_data->flag) == 0) event_loop_iterate(); g_thread_join(conn_data->thread); diff --git a/libsylph/utils.c b/libsylph/utils.c index ace360a7..b675c4fe 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -3881,7 +3881,7 @@ static gpointer execute_command_line_async_func(gpointer data) debug_print("execute_command_line_async_func: exec done: %s\n", cmd_data->cmdline); - cmd_data->flag = 1; + g_atomic_int_set(&cmd_data->flag, 1); g_main_context_wakeup(NULL); return GINT_TO_POINTER(0); @@ -3909,7 +3909,7 @@ gint execute_command_line_async_wait(const gchar *cmdline) return -1; debug_print("execute_command_line_async_wait: waiting thread\n"); - while (data.flag == 0) + while (g_atomic_int_get(&data.flag) == 0) event_loop_iterate(); g_thread_join(thread); |