RCU lock implementation
authorNeil Horman <nhorman@openssl.org>
Fri, 12 Jan 2024 15:39:56 +0000 (10:39 -0500)
committerNeil Horman <nhorman@openssl.org>
Thu, 1 Feb 2024 13:33:25 +0000 (08:33 -0500)
commitd0e1a0ae701cfaca7f3dd3bf28a3f934a6408813
treeffb54122cc592cf0a3ac3b6eb69e00dbf1e9f8a5
parentde18dc3a635c3a82c365b3f2beeb491c78b01b11
RCU lock implementation

Introduce an RCU lock implementation as an alternative locking mechanism
to openssl.  The api is documented in the ossl_rcu.pod
file

Read side implementaiton is comparable to that of RWLOCKS:
ossl_rcu_read_lock(lock);
<
critical section in which data can be accessed via
ossl_derefrence
>
ossl_rcu_read_unlock(lock);

Write side implementation is:
ossl_rcu_write_lock(lock);
<
critical section in which data can be updated via
ossl_assign_pointer
and stale data can optionally be scheduled for removal
via ossl_rcu_call
>
ossl_rcu_write_unlock(lock);
...
ossl_synchronize_rcu(lock);

ossl_rcu_call fixup

Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22729)
crypto/rcu_internal.h [new file with mode: 0644]
crypto/threads_none.c
crypto/threads_pthread.c
crypto/threads_win.c
doc/internal/man3/ossl_rcu_lock_new.pod [new file with mode: 0644]
include/internal/rcu.h [new file with mode: 0644]
test/threadstest.c