On Thu, Aug 17, 2023 at 01:54:01PM +1000, Sean Gallagher wrote:
> Hi OpenLDAP affiliates,
> 
> I'm working on a slapd module and have started looking at thread safety.
> 
> I've noticed that lloadd uses __atomic_xx GCC builtins but slapd does not.
> Is there are reason for this?
> 
> Does lloadd compile and run on all the same targets that slapd does?

Hi Sean,
lloadd has a slightly specific design in requiring non-blocking
operation on some critical paths so its memory management subsystem uses
atomics to achieve a partially lock-free implementation (epoch.c). It
also assumes POSIX interfaces internally (i.e. it has not been ported to
Windows yet).

slapd has always been extremely portable, its design does not need any
of the above and as such it relies exclusively on the much more portable
libldap API. You should be fine with mutexes/conditions which you get
from ldap_pvt_thread.h or even better rely on the locking slapd employs
already (connection_get, ...)

Regards,

-- 
Ondřej Kuzník
Senior Software Engineer
Symas Corporation                       http://www.symas.com
Packaged, certified, and supported LDAP solutions powered by OpenLDAP

Reply via email to