hooks: various improvements of handling of process-shared conditions and mutexes

 * use an SHM region to share the pshared mutex and conditions
 * implemented pthread_cond_timedwait_relative_np correctly