Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Issue 5189151393579008: Issue 2142 - Synchronize access to s_threadInstances in CPluginClass::OnTabChanged

Created:
March 16, 2015, 10:57 a.m. by Oleksandr
Modified:
June 15, 2015, 7:29 a.m.
Reviewers:
sergei, Eric
Visibility:
Public.

Description

Synchronize access to s_threadInstances in CPluginClass::OnTabChanged

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -0 lines) Patch
M src/plugin/PluginClass.cpp View 1 chunk +2 lines, -0 lines 1 comment Download

Messages

Total messages: 2
Oleksandr
March 16, 2015, 10:59 a.m. (2015-03-16 10:59:26 UTC) #1
Eric
March 16, 2015, 12:19 p.m. (2015-03-16 12:19:44 UTC) #2
I'm adding comments to #2142, since the way the issue description is written
leaves much to be desired.

The short version is that 's_threadinstances' has much larger problems that just
this place in the code. It's not even clear to me that the problem statement is
correct.

http://codereview.adblockplus.org/5189151393579008/diff/5629499534213120/src/...
File src/plugin/PluginClass.cpp (right):

http://codereview.adblockplus.org/5189151393579008/diff/5629499534213120/src/...
src/plugin/PluginClass.cpp:612: s_criticalSectionLocal.Lock();
The atomic action required here needs to surround both the call to 'find' as
well as adding a new element to the map.

Putting initialization inside the synchronized section isn't a good thing. Use
of the "test and set" pattern enables it to be outside.

Powered by Google App Engine
This is Rietveld