List pagination locking for state-data changes

Changed semantics of locking: instead of relying of locking running-db,
an automatic lock bound to a session is maintained. When the session closes
the lock is released.
This commit is contained in:
Olof hagsand 2021-10-28 14:49:33 +02:00
parent 197fc16e69
commit eea6d549f6
5 changed files with 25 additions and 19 deletions

View file

@ -545,6 +545,7 @@ example_statefile(clicon_handle h,
* @param[in] xpath Registered XPath using canonical prefixes
* @param[in] userargs Per-call user arguments
* @param[in] arg Per-path user argument
* @see example_lockdb
*/
int
example_pagination(void *h0,
@ -667,7 +668,7 @@ example_lockdb(clicon_handle h,
/* Part of cached pagination example
*/
if (strcmp(db, "running") == 0 && lock == 0 &&
if (strcmp(db, PAGINATE_STATE_LOCK) == 0 && lock == 0 &&
_state && _state_file && _state_file_cached && _state_file_transaction){
if (_state_xml_cache){
xml_free(_state_xml_cache);