This task is for a shared library interpolator. Here is a great article.
If the function is in the shared library, the runtime linker can be assigned to invoke another function “inserted”. Interposer can completely replace functionality or can increase it. A great example is the malloc family of functions, a memory leak detector and a heap creation tool can be based on a set of intermediate elements between a user program and system calls.
Interpolators work only for shared (.so) libraries. Static (.a) libraries directly reference the executable, and calls cannot be easily intercepted.
All major Linux support benefits come with LD_PRELOAD functions.
pthread_create.