mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
gtask: Separate GTask fields memory locations to avoid data races
Ensure that fields that might be accessed in two different threads, through conflicting actions are stored in seprate memory locations.
This commit is contained in:
parent
5eb9f9f214
commit
fef1ce37e4
17
gio/gtask.c
17
gio/gtask.c
@ -563,15 +563,22 @@ struct _GTask {
|
|||||||
/* This can’t be in the bit field because we access it from TRACE(). */
|
/* This can’t be in the bit field because we access it from TRACE(). */
|
||||||
gboolean thread_cancelled;
|
gboolean thread_cancelled;
|
||||||
|
|
||||||
gboolean check_cancellable : 1;
|
/* Protected by the lock when task is threaded: */
|
||||||
gboolean completed : 1;
|
|
||||||
gboolean return_on_cancel : 1;
|
|
||||||
gboolean synchronous : 1;
|
|
||||||
gboolean thread_complete : 1;
|
gboolean thread_complete : 1;
|
||||||
gboolean blocking_other_task : 1;
|
gboolean return_on_cancel : 1;
|
||||||
|
gboolean : 0;
|
||||||
|
|
||||||
|
/* Unprotected, but written to when task runs in thread: */
|
||||||
|
gboolean completed : 1;
|
||||||
gboolean had_error : 1;
|
gboolean had_error : 1;
|
||||||
gboolean result_set : 1;
|
gboolean result_set : 1;
|
||||||
gboolean ever_returned : 1;
|
gboolean ever_returned : 1;
|
||||||
|
gboolean : 0;
|
||||||
|
|
||||||
|
/* Read-only once task runs in thread: */
|
||||||
|
gboolean check_cancellable : 1;
|
||||||
|
gboolean synchronous : 1;
|
||||||
|
gboolean blocking_other_task : 1;
|
||||||
|
|
||||||
GError *error;
|
GError *error;
|
||||||
union {
|
union {
|
||||||
|
Loading…
Reference in New Issue
Block a user