diff options
Diffstat (limited to 'crypto/threads_win.c')
-rw-r--r-- | crypto/threads_win.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/crypto/threads_win.c b/crypto/threads_win.c index 873b2bd78c..a36e3752f6 100644 --- a/crypto/threads_win.c +++ b/crypto/threads_win.c @@ -168,7 +168,7 @@ void ossl_rcu_lock_free(CRYPTO_RCU_LOCK *lock) OPENSSL_free(lock); } -static inline struct rcu_qp *get_hold_current_qp(CRYPTO_RCU_LOCK *lock) +static ossl_inline struct rcu_qp *get_hold_current_qp(CRYPTO_RCU_LOCK *lock) { uint32_t qp_idx; @@ -357,17 +357,14 @@ void ossl_synchronize_rcu(CRYPTO_RCU_LOCK *lock) int ossl_rcu_call(CRYPTO_RCU_LOCK *lock, rcu_cb_fn cb, void *data) { struct rcu_cb_item *new; - struct rcu_cb_item *prev; new = OPENSSL_zalloc(sizeof(struct rcu_cb_item)); if (new == NULL) return 0; - prev = new; new->data = data; new->fn = cb; - InterlockedExchangePointer((void * volatile *)&lock->cb_items, prev); - new->next = prev; + new->next = InterlockedExchangePointer((void * volatile *)&lock->cb_items, new); return 1; } @@ -596,6 +593,22 @@ int CRYPTO_atomic_load(uint64_t *val, uint64_t *ret, CRYPTO_RWLOCK *lock) #endif } +int CRYPTO_atomic_store(uint64_t *dst, uint64_t val, CRYPTO_RWLOCK *lock) +{ +#if (defined(NO_INTERLOCKEDOR64)) + if (lock == NULL || !CRYPTO_THREAD_read_lock(lock)) + return 0; + *dst = val; + if (!CRYPTO_THREAD_unlock(lock)) + return 0; + + return 1; +#else + InterlockedExchange64(dst, val); + return 1; +#endif +} + int CRYPTO_atomic_load_int(int *val, int *ret, CRYPTO_RWLOCK *lock) { #if (defined(NO_INTERLOCKEDOR64)) |