MCPcopy Create free account
hub / github.com/apache/cloudberry / close

Method close

gpcontrib/gpcloud/src/s3key_reader.cpp:277–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277void S3KeyReader::close() {
278 // to interupt downlading thread, we must: (check ChunkBuffer::fill())
279 // 1. set condition to ReadyToFill and signal conditional_variable.
280 // 2. set the shared error status to prevent download thread from continuing.
281 this->sharedError = true;
282
283 for (uint64_t i = 0; i < this->chunkBuffers.size(); i++) {
284 UniqueLock lock(this->chunkBuffers[i].getStatMutex());
285 this->chunkBuffers[i].setStatus(ReadyToFill);
286 pthread_cond_signal(this->chunkBuffers[i].getStatCond());
287 }
288
289 for (uint64_t i = 0; i < this->threads.size(); i++) {
290 if (this->threads[i] == 0) {
291 continue;
292 }
293
294 pthread_join(this->threads[i], NULL);
295
296 this->threads[i] = 0;
297 }
298
299 this->reset();
300}

Callers 1

~S3KeyReaderMethod · 0.95

Calls 5

resetMethod · 0.95
getStatMutexMethod · 0.80
getStatCondMethod · 0.80
sizeMethod · 0.45
setStatusMethod · 0.45

Tested by

no test coverage detected