rcu.h 1.1 KB

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