| 51 | } |
| 52 | |
| 53 | void S3KeyWriter::checkQueryCancelSignal() { |
| 54 | if (S3QueryIsAbortInProgress() && !this->uploadId.empty()) { |
| 55 | // to avoid dead-lock when other upload threads hold the lock |
| 56 | pthread_mutex_unlock(&this->mutex); |
| 57 | |
| 58 | // wait for all threads to complete |
| 59 | for (size_t i = 0; i < threadList.size(); i++) { |
| 60 | pthread_join(threadList[i], NULL); |
| 61 | } |
| 62 | this->threadList.clear(); |
| 63 | |
| 64 | // to avoid double unlock as other parts may lock it |
| 65 | pthread_mutex_lock(&this->mutex); |
| 66 | |
| 67 | S3DEBUG("Start aborting multipart uploading (uploadID: %s, %lu parts uploaded)", |
| 68 | this->uploadId.c_str(), this->etagList.size()); |
| 69 | this->s3Interface->abortUpload(this->params.getS3Url(), this->uploadId); |
| 70 | S3DEBUG("Finished aborting multipart uploading (uploadID: %s)", this->uploadId.c_str()); |
| 71 | |
| 72 | this->etagList.clear(); |
| 73 | this->uploadId.clear(); |
| 74 | |
| 75 | S3_DIE(S3QueryAbort, "Uploading is interrupted"); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | struct ThreadParams { |
| 80 | S3KeyWriter* keyWriter; |
no test coverage detected