Skip to content

Commit

Permalink
change comments 'lock free' to 'thread safe'
Browse files Browse the repository at this point in the history
  • Loading branch information
lixinqi committed Jun 13, 2022
1 parent 1b0df76 commit d6f39eb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions oneflow/core/common/add_and_read_vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ limitations under the License.

namespace oneflow {

// `at` is lock free
template<typename T, int N = 20>
class AddAndReadVector {
public:
Expand All @@ -34,10 +33,10 @@ class AddAndReadVector {
using value_type = const T;
using size_type = size_t;

// not thread safe.
// thread safe.
size_t size() const { return size_; }

// lock free.
// thread safe.
const T& at(size_t index) const {
CHECK_GE(index, 0);
CHECK_LT(index, size_);
Expand All @@ -46,6 +45,7 @@ class AddAndReadVector {
return granularity2vector_[gran].data()[index - start];
}

// thread safe.
const T& operator[](size_t index) const {
int gran = GetGranularity(index);
int start = (1 << gran) - 1;
Expand Down

0 comments on commit d6f39eb

Please sign in to comment.