From 36e706b6e351e3ff315fed49c124865f599139cf Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Wed, 15 Jul 2020 14:51:05 +0000 Subject: 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. --- storage/src/tests/persistence/filestorage/operationabortingtest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'storage') 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 UP; - mutable uint32_t _bucketInfoInvocations; - uint32_t _createBucketInvocations; - uint32_t _deleteBucketInvocations; + mutable std::atomic _bucketInfoInvocations; + std::atomic _createBucketInvocations; + std::atomic _deleteBucketInvocations; BlockingMockProvider(spi::PersistenceProvider& wrappedProvider, vespalib::Barrier& queueBarrier, -- cgit v1.2.3