Re: [LTP] [PATCH 4/4] lib: add tst_res_r.c

chrubis
2014-02-13T13:04:45Z

Hi!
> >> glibc provides pthread mutex lock/unlock stubs, so i wonder if we even need _r
> >> variants. if the program hasn't linked against -lpthread, then the funcs will
> >> simply return. if it has, then you get locking.
> > That sounds interesting. Do you know if this is implemented in uClibc
> > (and possibly in other alternative libc libraries) too?
> If portability is acceptable we could put mutex initializer in the
> libltp. Another question should we lock/unlock mutex inside the libltp's
> functions or set it like in the example I sent previously (use wrapper
> macros)?

In a case that mutex stubs are common practice among libc
implementations I would be for adding the mutexes directly into the
libltp.a and do the locking inside the original functions. If not we
should go with wrappers.

--
Cyril Hrubis
chrubis@suse.cz