Skip to content

Commit 2cf976b

Browse files
authored
Update web-crawler-multithreaded.cpp
1 parent 70e424e commit 2cf976b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

C++/web-crawler-multithreaded.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class Solution {
1515
q_.emplace(startUrl);
1616
unordered_set<string> lookup = {startUrl};
1717
vector<thread> workers;
18-
const auto& worker = [&](unordered_set<string> *lookup) {
18+
const auto& worker = [this, &htmlParser](unordered_set<string> *lookup) {
1919
while (true) {
2020
string from_url;
2121
{
@@ -87,7 +87,7 @@ class Solution2 {
8787
unordered_set<string> lookup = {startUrl};
8888
vector<thread> workers;
8989
for (int i = 0; i < NUMBER_OF_WORKERS; ++i) {
90-
workers.emplace_back(bind(&Solution::worker, this, &htmlParser, &lookup));
90+
workers.emplace_back(bind(&Solution2::worker, this, &htmlParser, &lookup));
9191
}
9292
{
9393
unique_lock<mutex> lock{m_};

0 commit comments

Comments
 (0)