Title
Data races on vector<bool>
Status
resolved
Section
[container.requirements.dataraces]
Submitter
Jeffrey Yaskin

Created on 2010-03-09.00:00:00 last changed 171 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

Container data races [container.requirements.dataraces]

Paragraph 1 is unchanged as follows:

1 For purposes of avoiding data races (17.6.4.8), implementations shall consider the following functions to be const: begin, end, rbegin, rend, front, back, data, find, lower_bound, upper_bound, equal_range, and, except in associative containers, operator[].

Edit paragraph 2 as follows:

2 Notwithstanding (17.6.4.8), implementations are required to avoid data races when the contents of the contained object in different elements in the same sequence, excepting vector<bool>, are modified concurrently.

Edit paragraph 3 as follows:

3 [Note: For a vector<int> x with a size greater than one, x[1] = 5 and *x.begin() = 10 can be executed concurrently without a data race, but x[0] = 5 and *x.begin() = 10 executed concurrently may result in a data race. As an exception to the general rule, for a vector<bool> y, y[i] = true may race with y[j] = true.end note]

Date: 2010-10-21.18:28:33

Rationale:

Solved by N3069.

Date: 2010-12-05.00:09:22

[ 2010 Pittsburgh: Moved to NAD EditorialResolved. Rationale added below. ]

Date: 2010-03-09.00:00:00

The common implementation of vector<bool> is as an unsynchronized bitfield. The addition of [container.requirements.dataraces]/2 would require either a change in representation or a change in access synchronization, both of which are undesireable with respect to compatibility and performance.

History
Date User Action Args
2010-12-05 00:09:22adminsetstatus: nad editorial -> resolved
2010-10-21 18:28:33adminsetmessages: + msg1614
2010-10-21 18:28:33adminsetmessages: + msg1613
2010-10-21 18:28:33adminsetmessages: + msg1612
2010-03-09 00:00:00admincreate