X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust%2Flttng-ust-comm.c;h=7709b8dba6df5ed6cc4d5aff35c13988ff3b2114;hb=e68ef9fe0fe79429bd59bc8563d987ec7eb5b0d1;hp=92d590d408f0f7093d128cdb105f84c969b07ad4;hpb=94e6e686bf0a1a62de6d5d31fee783506b53ac1f;p=lttng-ust.git diff --git a/liblttng-ust/lttng-ust-comm.c b/liblttng-ust/lttng-ust-comm.c index 92d590d4..7709b8db 100644 --- a/liblttng-ust/lttng-ust-comm.c +++ b/liblttng-ust/lttng-ust-comm.c @@ -123,6 +123,28 @@ static int lttng_ust_comm_should_quit; */ int lttng_ust_loaded __attribute__((weak)); +/* + * Notes on async-signal-safety of ust lock: a few libc functions are used + * which are not strictly async-signal-safe: + * + * - pthread_setcancelstate + * - pthread_mutex_lock + * - pthread_mutex_unlock + * + * As of glibc 2.35, the implementation of pthread_setcancelstate only + * touches TLS data, and it appears to be safe to use from signal + * handlers. If the libc implementation changes, this will need to be + * revisited, and we may ask glibc to provide an async-signal-safe + * pthread_setcancelstate. + * + * As of glibc 2.35, the implementation of pthread_mutex_lock/unlock + * for fast mutexes only relies on the pthread_mutex_t structure. + * Disabling signals around all uses of this mutex ensures + * signal-safety. If the libc implementation changes and eventually uses + * other global resources, this will need to be revisited and we may + * need to implement our own mutex. + */ + /* * Return 0 on success, -1 if should quit. * The lock is taken in both cases.