Skip to content

Commit

Permalink
Merge pull request #7040 from hangshao0/v16
Browse files Browse the repository at this point in the history
(v0.16.0) Lock the cache inside markItemStaleCheckMutex().
  • Loading branch information
pshipton authored Sep 10, 2019
2 parents fc4e03a + a80fdc5 commit 867dab4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions runtime/shared_common/CacheMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4583,11 +4583,14 @@ SH_CacheMap::markItemStaleCheckMutex(J9VMThread* currentThread, const ShcItem* i
Trc_SHR_CM_markItemStaleCheckMutex_Entry(currentThread, item);

if (_ccHead->hasWriteMutex(currentThread)) {
_ccHead->markStale(currentThread, (BlockPtr)ITEMEND(item), isCacheLocked);
if (!isCacheLocked) {
_ccHead->doLockCache(currentThread); /* Wait till all readers stop and unprotect metadata area */
}
_ccHead->markStale(currentThread, (BlockPtr)ITEMEND(item), true);
} else {
_ccHead->exitReadMutex(currentThread, fnName);
if (_ccHead->enterWriteMutex(currentThread, false, fnName) == 0) {
_ccHead->markStale(currentThread, (BlockPtr)ITEMEND(item), isCacheLocked);
if (_ccHead->enterWriteMutex(currentThread, true, fnName) == 0) {
_ccHead->markStale(currentThread, (BlockPtr)ITEMEND(item), true);
_ccHead->exitWriteMutex(currentThread, fnName);
} else {
Trc_SHR_CM_markItemStaleCheckMutex_Failed(currentThread, item);
Expand Down

0 comments on commit 867dab4

Please sign in to comment.