Re: reentrant library functions



On Sep 17, 3:56 am, Chris Friesen <cbf...@xxxxxxxxxxxxx> wrote:
Mike wrote:
Hi, I am trying to create a library of some functions that allow
reentrancy, but I don't want to require compiling with the thread
library, "-lpthread", for programs that use my functions, but that
don't use threads. How do I do that?

Depending on what your library does, it may be possible to design the
API such that any resources which may be contended (memory buffers,
etc.) are passed in as arguments, with no state kept in the library
itself. In this way, the library doesn't explicitly require any
knowledge of threading.

Unfortunately, I can't do it that way.

Does anyone know offhand if the dbm B-tree routines allow threaded
access, or require linking with '-lpthread'?

Thanks,
-Mike
.