You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This state is possible, if the cache already has 3 items, then each of the 3 inserting threads find the exceeding size, then evicts one node, but yet has't insert its own node into list.
Any thread reach https://github.com/tstarling/thread-safe-lru/blob/master/thread-safe-lru/lru-cache.h#L378 is an error, since that branch doesn't evict a node, and leads to
m_size
not following the actual size of the list. But in current code this error might happen. If the cache state is as follow (with three inserting threads):This state is possible, if the cache already has 3 items, then each of the 3 inserting threads find the exceeding size, then evicts one node, but yet has't insert its own node into list.
At this time, if another thread comes and tries to evict, it will find the list is empty then go to https://github.com/tstarling/thread-safe-lru/blob/master/thread-safe-lru/lru-cache.h#L378.
The text was updated successfully, but these errors were encountered: