mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
SERVER-19001 Eliminate unnecessary potential race in the CallbackHandleComparsion executor unit test.
The test as previously written has a race condition if the executor is allowed to execute multiple callbacks concurrently, since both completion callbacks set the same status object. However, for this test, there is no need for them to set the same status object.
This commit is contained in:
parent
a816f73752
commit
7ec946113a
@ -450,14 +450,15 @@ COMMON_EXECUTOR_TEST(RemoteCommandWithTimeout) {
|
||||
|
||||
COMMON_EXECUTOR_TEST(CallbackHandleComparison) {
|
||||
TaskExecutor& executor = getExecutor();
|
||||
Status status(ErrorCodes::InternalError, "");
|
||||
auto status1 = getDetectableErrorStatus();
|
||||
auto status2 = getDetectableErrorStatus();
|
||||
const RemoteCommandRequest request(HostAndPort("lazy", 27017), "admin", BSON("cmd" << 1));
|
||||
TaskExecutor::CallbackHandle cbHandle1 = unittest::assertGet(executor.scheduleRemoteCommand(
|
||||
request,
|
||||
stdx::bind(setStatusOnRemoteCommandCompletion, stdx::placeholders::_1, request, &status)));
|
||||
stdx::bind(setStatusOnRemoteCommandCompletion, stdx::placeholders::_1, request, &status1)));
|
||||
TaskExecutor::CallbackHandle cbHandle2 = unittest::assertGet(executor.scheduleRemoteCommand(
|
||||
request,
|
||||
stdx::bind(setStatusOnRemoteCommandCompletion, stdx::placeholders::_1, request, &status)));
|
||||
stdx::bind(setStatusOnRemoteCommandCompletion, stdx::placeholders::_1, request, &status2)));
|
||||
|
||||
// test equality
|
||||
ASSERT_TRUE(cbHandle1 == cbHandle1);
|
||||
|
Loading…
Reference in New Issue
Block a user