From 20d53cad15e1fd40df2ac4a8c9d35a7956ba19dc Mon Sep 17 00:00:00 2001 From: kanoi Date: Wed, 2 Sep 2015 23:15:58 +1000 Subject: [PATCH] ckdb - demote shift_rewards payouts lock to read - no payout data is changed --- src/ckdb.h | 2 +- src/ckdb_data.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ckdb.h b/src/ckdb.h index 6ae1bdd4..70f9df1f 100644 --- a/src/ckdb.h +++ b/src/ckdb.h @@ -55,7 +55,7 @@ #define DB_VLOCK "1" #define DB_VERSION "1.0.2" -#define CKDB_VERSION DB_VERSION"-1.230" +#define CKDB_VERSION DB_VERSION"-1.231" #define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL_HERE __FILE__, __func__, __LINE__ diff --git a/src/ckdb_data.c b/src/ckdb_data.c index 0700f727..fd8ca978 100644 --- a/src/ckdb_data.c +++ b/src/ckdb_data.c @@ -4682,7 +4682,7 @@ bool shift_rewards(K_ITEM *wm_item) DATA_WORKMARKERS(wm, wm_item); // Deadlock risk since calling code should have workmarkers locked - K_WLOCK(payouts_free); + K_RLOCK(payouts_free); p_item = find_payouts_wid(wm->workinfoidend, ctx); DATA_PAYOUTS_NULL(payouts, p_item); // a workmarker should not cross a payout boundary @@ -4693,7 +4693,7 @@ bool shift_rewards(K_ITEM *wm_item) p_item = prev_in_ktree(ctx); DATA_PAYOUTS_NULL(payouts, p_item); } - K_WUNLOCK(payouts_free); + K_RUNLOCK(payouts_free); wm->rewards = rewards; return (rewards > 0);