Skip to content

Commit

Permalink
Removed brittle checks in connection_pool_cancel test
Browse files Browse the repository at this point in the history
These checks could cause false positive race conditions to be reported.
  • Loading branch information
anarthal committed Nov 4, 2024
1 parent 8b2727f commit b6d9f1e
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions test/thread_safety/connection_pool_cancel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
#include <boost/mysql/pool_params.hpp>

#include <boost/asio/bind_executor.hpp>
#include <boost/asio/cancel_after.hpp>
#include <boost/asio/detached.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/thread_pool.hpp>

#include <chrono>
#include <memory>

#include "tsan_pool_common.hpp"
Expand All @@ -31,7 +29,6 @@ void run(const char* hostname)
// Setup
asio::thread_pool ctx(8);

// Using cancel()
for (int i = 0; i < 20; ++i)
{
// Create a pool
Expand All @@ -44,16 +41,6 @@ void run(const char* hostname)
asio::post(asio::bind_executor(ctx.get_executor(), [pool]() { pool->cancel(); }));
}

// Using per-operation cancellation
for (int i = 0; i < 20; ++i)
{
// Create a pool
mysql::connection_pool pool(ctx, create_pool_params(hostname, 10));

// Run the pool for a short period of time
pool.async_run(asio::cancel_after(std::chrono::milliseconds(1), asio::detached));
}

// Run
ctx.join();
}
Expand Down

0 comments on commit b6d9f1e

Please sign in to comment.