summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2018-09-18 17:23:04 +0200
committerMichel Dänzer <[email protected]>2018-09-28 17:52:11 +0200
commitcb863de626486a10273281e89534471549a242a7 (patch)
treef0bde2c1899631ee2dba617d362682b1cf5f6a0b /src
parent3fb4adae83f921bbf529fad8753c7e23b969a41d (diff)
gallium/util: Clarify comment in util_init_thread_pinning
As discussed in the review of the patch which added the comment: Nothing happens when a thread is created, because pthread_atfork doesn't affect creating threads. However, spawning a child process will likely crash. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/util/u_helpers.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_helpers.c b/src/gallium/auxiliary/util/u_helpers.c
index b6cebf96329..4c70c004178 100644
--- a/src/gallium/auxiliary/util/u_helpers.c
+++ b/src/gallium/auxiliary/util/u_helpers.c
@@ -148,7 +148,10 @@ util_init_thread_pinning(void)
/* Reset thread affinity for all child processes to prevent them from
* inheriting the current thread's affinity.
*
- * What happens if a driver is unloaded and the app creates a thread?
+ * XXX: If the driver is unloaded after this, and the app later calls
+ * fork(), the child process will likely crash before fork() returns,
+ * because the address where util_set_full_cpu_affinity was located
+ * will either be unmapped or point to random other contents.
*/
pthread_atfork(NULL, NULL, util_set_full_cpu_affinity);
}