> I'm porting an application to POSIX threads (actually, I'm porting it
> to use an underlying library which handles event management, so I
> don't use the pthreads interface directly) so -- among other things,
> to be sure -- I'll need to change the application to use the *_r
> functions. The application runs on AIX, Solaris, HP-UX and NT.
> (I don't care about NT at the moment.) What do I need to do on
> each platform to ensure that we use these functions, and -- more
> importantly -- that the application is MT-safe?
> First, I believe we need to use -D_REENTRANT and, of course,
> modify all non-MT-safe C library calls to use the *_r interface
As this overwrits a lot of routines
We had a lot of problems with pthreads under 10.20 and a fair part
went way after only using this include EVERYWHERE
there is a very nice HP manual "Programming with threads", which
gives a lot of useful hints and do/donts (e.g. functions to avoid ...)
> Link against -c_r?
> Doesn't look like you need special linkage on Solaris to get
> the _r functions. Is that correct.
> On HP-UX 11.00 libc_r.sl is a symbolic link to libc.sl. Does
> one need to link against -lc_r as well? What's the purpose of
> the link?
> Most if not all of the data in each thread sits on the stack.
> (The global data is accessed via and protected by the underlying
> library.) So other than checking whether our own functions rely
> on static buffers, I don't think I have to change much else.
> I'm particularly interested in what one needs to do in order to
> use the *_r interface. It'd be nice to be able to use the *_r
> interface without any side effects (e.g., automatically being
> linked against -lpthread, or something awful like that). Since
> the library this application is built on allows you to use user-space
> threads or POSIX threads, I'd like to be able to build for either
> with minimal hassle.
> Nick Dronen
< 1K Download