ckdb - allow creating a store inside a list lock
This commit is contained in:
parent
373f9b01df
commit
7cedce99d0
@ -58,7 +58,7 @@
|
||||
|
||||
#define DB_VLOCK "1"
|
||||
#define DB_VERSION "1.0.7"
|
||||
#define CKDB_VERSION DB_VERSION"-2.713"
|
||||
#define CKDB_VERSION DB_VERSION"-2.714"
|
||||
|
||||
#define WHERE_FFL " - from %s %s() line %d"
|
||||
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__
|
||||
|
||||
@ -3348,7 +3348,7 @@ static char *cmd_heartbeat(__maybe_unused PGconn *conn, char *cmd, char *id,
|
||||
goto pulse;
|
||||
}
|
||||
|
||||
hq_store = k_new_store(heartbeatqueue_free);
|
||||
hq_store = k_new_store_locked(heartbeatqueue_free);
|
||||
k_list_transfer_to_head(heartbeatqueue_store, hq_store);
|
||||
K_WUNLOCK(heartbeatqueue_free);
|
||||
|
||||
|
||||
@ -191,7 +191,7 @@ static void k_alloc_items(K_LIST *list, KLIST_FFL_ARGS)
|
||||
list->count_up = allocate;
|
||||
}
|
||||
|
||||
K_STORE *_k_new_store(K_LIST *list, KLIST_FFL_ARGS)
|
||||
K_STORE *_k_new_store(K_LIST *list, bool gotlock, KLIST_FFL_ARGS)
|
||||
{
|
||||
K_STORE *store;
|
||||
|
||||
@ -212,14 +212,16 @@ K_STORE *_k_new_store(K_LIST *list, KLIST_FFL_ARGS)
|
||||
store->next_store = NULL;
|
||||
store->master->stores++;
|
||||
} else {
|
||||
K_WLOCK(list);
|
||||
if (!gotlock)
|
||||
K_WLOCK(list);
|
||||
// In the master list, next is the head
|
||||
if (list->next_store)
|
||||
list->next_store->prev_store = store;
|
||||
store->next_store = list->next_store;
|
||||
list->next_store = store;
|
||||
list->stores++;
|
||||
K_WUNLOCK(list);
|
||||
if (!gotlock)
|
||||
K_WUNLOCK(list);
|
||||
}
|
||||
|
||||
return store;
|
||||
|
||||
@ -668,8 +668,9 @@ static inline K_ITEM *list_rtail(K_LIST *list)
|
||||
|
||||
extern void _dsp_kstore(K_STORE *store, char *filename, char *msg, KLIST_FFL_ARGS);
|
||||
#define dsp_kstore(_store, _file, _msg) _dsp_kstore(_store, _file, _msg, KLIST_FFL_HERE)
|
||||
extern K_STORE *_k_new_store(K_LIST *list, KLIST_FFL_ARGS);
|
||||
#define k_new_store(_list) _k_new_store(_list, KLIST_FFL_HERE)
|
||||
extern K_STORE *_k_new_store(K_LIST *list, bool gotlock, KLIST_FFL_ARGS);
|
||||
#define k_new_store(_list) _k_new_store(_list, false, KLIST_FFL_HERE)
|
||||
#define k_new_store_locked(_list) _k_new_store(_list, true, KLIST_FFL_HERE)
|
||||
extern K_LIST *_k_new_list(const char *name, size_t siz, int allocate,
|
||||
int limit, bool do_tail, bool lock_only,
|
||||
bool without_lock, bool local_list,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user