Merge pull request #1764 from jtramm/seq_cst_fix

Fix for SharedArray relaxed memory ordering problem
This commit is contained in:
Paul Romano 2021-03-08 14:27:06 -06:00 committed by GitHub
commit ef3a1642db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -73,12 +73,12 @@ public:
{
// Atomically capture the index we want to write to
int64_t idx;
#pragma omp atomic capture
#pragma omp atomic capture seq_cst
idx = size_++;
// Check that we haven't written off the end of the array
if (idx >= capacity_) {
#pragma omp atomic write
#pragma omp atomic write seq_cst
size_ = capacity_;
return -1;
}