Sending a notification to the main nginx thread

Eran Kornblau eran.kornblau at
Thu Oct 7 15:16:37 UTC 2021

> -----Original Message-----
> From: nginx-devel <nginx-devel-bounces at> On Behalf Of Maxim Dounin
> Sent: Thursday, 7 October 2021 16:07
> To: nginx-devel at
> Subject: Re: Sending a notification to the main nginx thread
> Hello!
> To re-iterate: inside a "side thread" you are not allowed to call any non-thread-safe libc functions.  It is reasonable to assume this excludes all 3rd party libraries with their own even loops.

This is a valid point. 

I checked it out, with the specific build options I'm using on Linux, these are the non-thread-safe libc functions used by nginx -
(list of all non-thread-safe functions taken from, assuming POSIX.1-2008) -

$ (objdump -T /usr/local/nginx/sbin/nginx | grep GLIBC | awk '{print $NF}' ; cat /tmp/libc-non-thread-safe) | sort | uniq -c | grep -vw 1
      2 dlerror
      2 getenv
      2 getgrnam
      2 getpwnam
      2 localtime
      2 strerror

First 4 functions are called only early on nginx startup from what I see, so not relevant in this context.
That leaves me only with strerror & localtime. 

I verified these 2 functions are not used by the specific library I'm linking against.
So, assuming I don't use any nginx functions on the side thread (other than ngx_notify), it feels quite safe to me...



> --
> Maxim Dounin
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at

More information about the nginx-devel mailing list