Make version counter in mlist_t volatile

The log manager is the only one that uses the mlist_t versioned list. The
counter that keeps track of the version number was not modified using
atomic operations meaning that the compiler is free to optimize away parts
of the lock-free versioning mechanism that uses it.

To prevent this optimization, the variable is declared volatile. A rewrite
is direly needed but it cannot be done in 2.2.
This commit is contained in:
Markus Mäkelä 2018-07-05 11:46:23 +03:00
parent f5110209f7
commit 33fa9b26fe
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -32,7 +32,7 @@ typedef struct mlist_st
bool mlist_deleted;
size_t mlist_nodecount;
size_t mlist_nodecount_max; /**< size limit. 0 == no limit */
size_t mlist_versno;
volatile size_t mlist_versno;
bool mlist_flat;
mlist_node_t* mlist_first;
mlist_node_t* mlist_last;