Skip to content

Commit 1cad2e6

Browse files
committed
remove std::thread read_csv_worker, useless and buggy in seastar
1 parent 5e62b7a commit 1cad2e6

File tree

5 files changed

+1029
-1017
lines changed

5 files changed

+1029
-1017
lines changed

include/internal/csv_reader.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,12 @@ namespace csv {
280280
return false;
281281
else {
282282
// Reading thread is not active => start another one
283-
if (this->read_csv_worker.joinable())
284-
this->read_csv_worker.join();
283+
// if (this->read_csv_worker.joinable())
284+
// this->read_csv_worker.join();
285+
286+
// this->read_csv_worker = std::thread(&CSVReader::read_csv, this, internals::ITERATION_CHUNK_SIZE);
287+
this->read_csv(internals::ITERATION_CHUNK_SIZE);
285288

286-
this->read_csv_worker = std::thread(&CSVReader::read_csv, this, internals::ITERATION_CHUNK_SIZE);
287289
}
288290
}
289291
else if (this->records->front().size() != this->n_cols &&

include/internal/csv_reader.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ namespace csv {
134134
CSVReader& operator=(const CSVReader&) = delete; // No copy assignment
135135
CSVReader& operator=(CSVReader&& other) = default;
136136
~CSVReader() {
137-
if (this->read_csv_worker.joinable()) {
138-
this->read_csv_worker.join();
139-
}
137+
// if (this->read_csv_worker.joinable()) {
138+
// this->read_csv_worker.join();
139+
// }
140140
}
141141

142142
/** @name Retrieving CSV Rows */
@@ -216,13 +216,14 @@ namespace csv {
216216

217217
/** @name Multi-Threaded File Reading: Flags and State */
218218
///@{
219-
std::thread read_csv_worker; /**< Worker thread for read_csv() */
219+
// std::thread read_csv_worker; /**< Worker thread for read_csv() */
220220
///@}
221221

222222
/** Read initial chunk to get metadata */
223223
void initial_read() {
224-
this->read_csv_worker = std::thread(&CSVReader::read_csv, this, internals::ITERATION_CHUNK_SIZE);
225-
this->read_csv_worker.join();
224+
// this->read_csv_worker = std::thread(&CSVReader::read_csv, this, internals::ITERATION_CHUNK_SIZE);
225+
// this->read_csv_worker.join();
226+
this->read_csv(internals::ITERATION_CHUNK_SIZE);
226227
}
227228

228229
void trim_header();

include/internal/csv_reader_iterator.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ namespace csv {
88
/** Return an iterator to the first row in the reader */
99
CSV_INLINE CSVReader::iterator CSVReader::begin() {
1010
if (this->records->empty()) {
11-
this->read_csv_worker = std::thread(&CSVReader::read_csv, this, internals::ITERATION_CHUNK_SIZE);
12-
this->read_csv_worker.join();
11+
// this->read_csv_worker = std::thread(&CSVReader::read_csv, this, internals::ITERATION_CHUNK_SIZE);
12+
// this->read_csv_worker.join();
13+
this->read_csv(internals::ITERATION_CHUNK_SIZE);
1314

1415
// Still empty => return end iterator
1516
if (this->records->empty()) return this->end();

0 commit comments

Comments
 (0)