Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions test/test/multi_threaded_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace concurrent_collections
// for the first time on the background thread.
enum class collection_action
{
none, push_back, insert, erase, at, lookup
none, push_back, insert, erase, at, lookup, advance
};

// All of our concurrency tests consists of starting an
Expand Down Expand Up @@ -165,36 +165,46 @@ namespace concurrent_collections
return owner->dereference_iterator(inner());
}

// inherited: pointer operator->() const;
pointer operator->() const
{
auto guard = owner->lock_const();
owner->call_hook(collection_action::at);
return iterator::operator->();
}

concurrency_checked_random_access_iterator& operator++()
{
owner->call_hook(collection_action::advance);
++inner();
return *this;
}

concurrency_checked_random_access_iterator& operator++(int)
{
owner->call_hook(collection_action::advance);
auto prev = *this;
++inner();
return prev;
}

concurrency_checked_random_access_iterator& operator--()
{
owner->call_hook(collection_action::advance);
--inner();
return *this;
}

concurrency_checked_random_access_iterator& operator--(int)
{
owner->call_hook(collection_action::advance);
auto prev = *this;
--inner();
return prev;
}

concurrency_checked_random_access_iterator& operator+=(difference_type offset)
{
owner->call_hook(collection_action::advance);
inner() += offset;
return *this;
}
Expand All @@ -206,6 +216,7 @@ namespace concurrent_collections

concurrency_checked_random_access_iterator& operator-=(difference_type offset)
{
owner->call_hook(collection_action::advance);
inner() -= offset;
return *this;
}
Expand Down
4 changes: 2 additions & 2 deletions test/test/multi_threaded_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ namespace
{
// MoveNext vs Remove
bool moved = false;
race(collection_action::at, [&]
race(collection_action::advance, [&]
{
try
{
Expand Down Expand Up @@ -273,7 +273,7 @@ namespace
{
// MoveNext vs Insert
bool moved = false;
race(collection_action::at, [&]
race(collection_action::advance, [&]
{
try
{
Expand Down