DLLOCKINIT(3)
πΈ NAME πΈ
dllockinit β register thread locking methods with the dynamic linker. Also hi bestie, this is the DLLOCKINIT(3) page from the Library Functions Manual, folded in right here near the top π«Ά
π LIBRARY π
Standard C Library (libc, -lc) π
β¨ SYNOPSIS β¨
#include <dlfcn.h>
void
dllockinit(void *context, void *(*lock_create)(void *context),
void (*rlock_acquire)(void *lock),
void (*wlock_acquire)(void *lock), void (*lock_release)(void *lock),
void (*lock_destroy)(void *lock),
void (*context_destroy)(void *context));
π DESCRIPTION π
Okay so first things first, bestie: this interface is deprecated, and it's deprecated for a reason. Due to enhancements in the dynamic linker, this interface is no longer needed. It is deprecated and will be removed from future releases. In current releases it still exists, but only as a stub which does nothing. π
Threads packages can call dllockinit() at initialization time to register locking functions for the dynamic linker to use. This enables the dynamic linker to prevent multiple threads from entering its critical sections simultaneously. π
Here's the cast of arguments, because we're not skipping anyone:
contextβ an opaque context for creating locks. The dynamic linker will pass it to thelock_createfunction when creating the locks it needs. When the dynamic linker is permanently finished using the locking functions (e.g., if the program makes a subsequent call todllockinit()to register new locking functions), it will callcontext_destroyto destroy the context. β¨lock_createβ a function for creating a read/write lock. It must return a pointer to the new lock.rlock_acquireβ a function which locks a lock for reading. It is passed a pointer to the lock.wlock_acquireβ a function which locks a lock for writing. It is passed a pointer to the lock.lock_releaseβ a function which unlocks a lock. It is passed a pointer to the lock.lock_destroyβ a function to destroy a lock. It may beNULLif locks do not need to be destroyed.context_destroyβ a function to destroy the context. It may beNULLif the context does not need to be destroyed.
Until dllockinit() is called, the dynamic linker protects its critical sections using a default locking mechanism which works by blocking the SIGVTALRM, SIGPROF, and SIGALRM signals. This is sufficient for many application level threads packages, which typically use one of these signals to implement preemption. An application which has registered its own locking methods with dllockinit() can restore the default locking by calling dllockinit() with all arguments NULL. π
π SEE ALSO π
π¦ HISTORY π¦
The dllockinit() function first appeared in FreeBSD 4.0. β
mwah π β this page's source/version is Debian, dated July 5, 2000. Stay slay, bestie π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- Copyright (c) 1999, 2000 John D. Polstra
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms