GNU Info

Info Node: (libtool.info)Thread Safety in libltdl

(libtool.info)Thread Safety in libltdl


Next: User defined module data Prev: Modules for libltdl Up: Using libltdl
Enter node , (file) or (file)node

Using libtldl in a multi threaded environment
=============================================

   Using the `lt_dlmutex_register()' function, and by providing some
appropriate callback function definitions, libltdl can be used in a
multi-threaded environment.

 - Type: void lt_dlmutex_lock (void)
     This is the type of a function pointer holding the address of a
     function which will be called at the start of parts of the libltdl
     implementation code which require a mutex lock.

     Because libltdl is inherantly recursive, it is important that the
     locking mechanism employed by these callback functions are
     reentrant, or else strange problems will occur.

 - Type: void lt_dlmutex_unlock (void)
     The type of a matching unlock function.

 - Type: void lt_dlmutex_seterror (const char *ERROR);
     Many of the functions in the libltdl API have a special return
     value to indicate to the client that an error has occured.
     Normally (in single threaded applications) a string describing
     that error can be retrieved from internal storage with
     `lt_dlerror()'.

     A function of this type must be registered with the library in
     order for it to work in a multi-threaded context.  The function
     should store any error message passed in thread local storage.

 - Type: const char * lt_dlmutex_geterror (void)
     The type of a matching callback function to retrieve the last
     stored error message from thread local storage.

     When regeistered correctly this function will be used by
     `lt_dlerror())' from all threads to retrieve error messages for the
     client.

 - Function: int lt_dlmutex_register (lt_dlmutex_lock *LOCK,
          lt_dlmutex_unlock *UNLOCK, lt_dlmutex_set_error *SETERROR,
          lt_dlmutex_geterror *GETERROR)
     Use this function to register one of each of function ttypes
     described above in preparation for multi-threaded use of libltdl.
     All arguments must be valid non-`NULL' function addresses, or else
     all `NULL' to return to single threaded operation.


automatically generated by info2www version 1.2.2.9