Search code examples
linuxmacostimerprocess

Does 'per process' also count towards shared libs / dylibs?


I want to use the alarm function to have an interrupt to arrange for a timeout on a blocking call to fcntl + F_SETLKW (for lock file acquisition). However, my code lives in a shared library / dylib (a plugin for a host app), and the docu for alarm states that these timers are per-process.

Am I correct to conclude that using alarm from a shared lib / dylib might interfere with the host app if it itself also uses the timer or sleep or... as well? And what about other so's / dylibs loaded into the same host process? (I'm creating a whole suite of different plugins, so they would also all interfere with each other when more than one is loaded at the same time, right?)

Is this generally true -- i.e. if the man states something is per-process, is it thus also shared with all loaded so's/dylibs?


Solution

  • Yes, since the libraries are loaded to the process and are running in its' context.