diff options
author | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2020-07-15 14:51:05 +0000 |
---|---|---|
committer | Tor Brede Vekterli <vekterli@verizonmedia.com> | 2020-07-15 14:51:05 +0000 |
commit | 36e706b6e351e3ff315fed49c124865f599139cf (patch) | |
tree | 9fe3096b215c8b77315f79a73724e1e7b23ee6c4 /storage | |
parent | 59332ffc463715515f6e15d87834f0646e461ab9 (diff) |
Ensure operation counting is thread-safe
With the introduction of async response handling, SPI getBucketInfo()
can now be called from multiple threads concurrently. Test was not
originally written with that in mind. Use std::atomic instead of unsafe
raw increment.
For future-proofing, also make other counters atomic.
Diffstat (limited to 'storage')
-rw-r--r-- | storage/src/tests/persistence/filestorage/operationabortingtest.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp index e9f878bfe1e..93c484368de 100644 --- a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp +++ b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp @@ -31,9 +31,9 @@ class BlockingMockProvider : public PersistenceProviderWrapper public: typedef std::unique_ptr<BlockingMockProvider> UP; - mutable uint32_t _bucketInfoInvocations; - uint32_t _createBucketInvocations; - uint32_t _deleteBucketInvocations; + mutable std::atomic<uint32_t> _bucketInfoInvocations; + std::atomic<uint32_t> _createBucketInvocations; + std::atomic<uint32_t> _deleteBucketInvocations; BlockingMockProvider(spi::PersistenceProvider& wrappedProvider, vespalib::Barrier& queueBarrier, |