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
.



Relevant Pages

  • Re: reentrant library functions
    ... Mike wrote: ... reentrancy, but I don't want to require compiling with the thread ... 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. ...
    (comp.os.linux.development.system)
  • Re: reentrant library functions
    ... reentrancy, but I don't want to require compiling with the thread ... Here you say you don't want to require *compiling* with the thread ... If you were able to get linker errors, that means you had something to ... specify the '-lpthread' flag to compile. ...
    (comp.os.linux.development.system)
  • Re: reentrant library functions
    ... reentrancy, but I don't want to require compiling with the thread ... First, to correct one error in your post, '-lpthread' is a linker flag ... and has no effect on compiling. ... or else I get linker errors. ...
    (comp.os.linux.development.system)