1 1.1 christos /* 2 1.1 christos * Copyright 2023-2024 The OpenSSL Project Authors. All Rights Reserved. 3 1.1 christos * 4 1.1 christos * Licensed under the Apache License 2.0 (the "License"). You may not use 5 1.1 christos * this file except in compliance with the License. You can obtain a copy 6 1.1 christos * in the file LICENSE in the source distribution or at 7 1.1 christos * https://www.openssl.org/source/license.html 8 1.1 christos */ 9 1.1 christos 10 1.1 christos #ifndef OPENSSL_RCU_H 11 1.1.1.2 christos #define OPENSSL_RCU_H 12 1.1.1.2 christos #pragma once 13 1.1 christos 14 1.1 christos #include "crypto/context.h" 15 1.1 christos 16 1.1 christos typedef void (*rcu_cb_fn)(void *data); 17 1.1 christos 18 1.1 christos typedef struct rcu_lock_st CRYPTO_RCU_LOCK; 19 1.1 christos 20 1.1 christos CRYPTO_RCU_LOCK *ossl_rcu_lock_new(int num_writers, OSSL_LIB_CTX *ctx); 21 1.1 christos void ossl_rcu_lock_free(CRYPTO_RCU_LOCK *lock); 22 1.1 christos void ossl_rcu_read_lock(CRYPTO_RCU_LOCK *lock); 23 1.1 christos void ossl_rcu_write_lock(CRYPTO_RCU_LOCK *lock); 24 1.1 christos void ossl_rcu_write_unlock(CRYPTO_RCU_LOCK *lock); 25 1.1 christos void ossl_rcu_read_unlock(CRYPTO_RCU_LOCK *lock); 26 1.1 christos void ossl_synchronize_rcu(CRYPTO_RCU_LOCK *lock); 27 1.1 christos int ossl_rcu_call(CRYPTO_RCU_LOCK *lock, rcu_cb_fn cb, void *data); 28 1.1 christos void *ossl_rcu_uptr_deref(void **p); 29 1.1 christos void ossl_rcu_assign_uptr(void **p, void **v); 30 1.1 christos #define ossl_rcu_deref(p) ossl_rcu_uptr_deref((void **)p) 31 1.1.1.2 christos #define ossl_rcu_assign_ptr(p, v) ossl_rcu_assign_uptr((void **)p, (void **)v) 32 1.1 christos 33 1.1 christos #endif 34