Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding unit tests for checking that closing unbuffered channel closes all blocked senders and receivers #8067

Merged

Conversation

abhinavarora
Copy link
Contributor

No description provided.

},
&thread_ended[i]);
}
std::this_thread::sleep_for(std::chrono::milliseconds(100)); // wait 0.5 sec
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that waiting time is 0.1 sec but not 0.5 sec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you fixed.

t[i] = std::thread(
[&](bool *p) {
int data;
ch->Receive(&data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two possibilities for the return of Receive:

  1. the Channel was closed.
  2. the Send of this Channel was called.

I think we should separate them. When the Channel was closed, the point of data should be nullptr. Otherwise, it should be not nullptr.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean the data pointer that is passed to Receive, that should be null.

Copy link
Contributor

@chengduoZH chengduoZH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@abhinavarora abhinavarora merged commit a4cf6a2 into PaddlePaddle:develop Feb 2, 2018
@abhinavarora abhinavarora deleted the unit_test_destructor branch February 2, 2018 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants