Comment by yrro
You're probably aware of c-ares, if not then check it out unless you really want to write your own.
(As an administrator I'm getting a bit tired of working around the differing bugs and behaviour of different resolver implementations).
glibc also has an async getaddrinfo_a function for asynchronous name resolution, with completion notification.
I will look into it even if I end up writing my own. Reading source code is always helpful. Thank you.