New issue
Advanced search Search tips

Issue 784640 link

Starred by 1 user

Issue metadata

Status: Untriaged
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

base::ObserverList is not thread-compatible

Project Member Reported by fdegros@chromium.org, Nov 13 2017

Issue description

Const methods of base::ObserverList cannot be called concurrently on the same object in different threads. 

Especially, it is not safe to iterate over a const ObserverList, even using const iterators, simultaneously in multiple threads.

I don't know if this is an actual problem, but it is surprising.

The destructor of ObserverList::const_iterator decrements ObserverList::notify_depth_. This reference count is not atomic nor synchronized.

Note that the const_cast on https://cs.chromium.org/chromium/src/base/observer_list.h?l=191&rcl=c5dcb8488883447904af5b68e0aa9c1d68d56508 is somehow related to this issue.

 
Components: Internals>Core

Sign in to add a comment