Skip to content

Commit

Permalink
Downloader: Join threads in CancelAll
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Jun 28, 2020
1 parent 1a8084c commit bd8083f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ext/native/net/http_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ void Download::Start() {
}

void Download::Join() {
if (joined_) {
ELOG("Already joined thread!");
}
thread_.join();
joined_ = true;
}
Expand Down Expand Up @@ -585,6 +588,9 @@ void Downloader::CancelAll() {
for (size_t i = 0; i < downloads_.size(); i++) {
downloads_[i]->Cancel();
}
for (size_t i = 0; i < downloads_.size(); i++) {
downloads_[i]->Join();
}
downloads_.clear();
}

Expand Down

0 comments on commit bd8083f

Please sign in to comment.