44 log_verbose( stderr,
"starting background input thread\n" );
52 m_free_pool.push( &m_read_data_storage[i] );
60 while (read_data == NULL)
64 if (m_free_pool.empty() ==
false)
66 read_data = m_free_pool.top();
73 log_debug( stderr,
" reading input batch %u\n", m_set );
78 const int ret =
io::next(
DNA_N, read_data, m_read_data_stream, m_batch_size, m_batch_size*m_read_length );
85 m_ready_pool.push_front( read_data );
86 m_ready_poolN.push_front( m_reads );
88 m_reads += read_data->
size();
106 log_error(stderr,
"caught a nvbio::bad_alloc exception:\n");
112 log_error(stderr,
"caught a nvbio::logic_error exception:\n");
118 log_error(stderr,
"caught a nvbio::runtime_error exception:\n");
122 catch (std::bad_alloc e)
124 log_error(stderr,
"caught a std::bad_alloc exception:\n");
128 catch (std::logic_error e)
130 log_error(stderr,
"caught a std::logic_error exception:\n");
134 catch (std::runtime_error e)
136 log_error(stderr,
"caught a std::runtime_error exception:\n");
142 log_error(stderr,
"caught an unknown exception!\n");
156 if (m_ready_pool.empty() ==
false)
160 m_ready_pool.pop_back();
161 if (offset) *offset = m_ready_poolN.back();
162 m_ready_poolN.pop_back();
167 if (offset) *offset = m_reads;
181 m_free_pool.push( read_data );
186 log_verbose( stderr,
"starting background paired-end input thread\n" );
195 m_free_pool1.push( &m_read_data_storage1[i] );
196 m_free_pool2.push( &m_read_data_storage2[i] );
206 while (read_data1 == NULL || read_data2 == NULL)
210 if (m_free_pool1.empty() ==
false &&
211 m_free_pool2.empty() ==
false)
213 read_data1 = m_free_pool1.top(); m_free_pool1.pop();
214 read_data2 = m_free_pool2.top(); m_free_pool2.pop();
220 log_debug( stderr,
" reading input batch %u\n", m_set );
225 const int ret1 =
io::next(
DNA_N, read_data1, m_read_data_stream1, m_batch_size, m_batch_size*m_read_length );
226 const int ret2 =
io::next(
DNA_N, read_data2, m_read_data_stream2, read_data1->
size() );
233 m_ready_pool1.push_front( read_data1 );
234 m_ready_pool2.push_front( read_data2 );
235 m_ready_poolN.push_front( m_reads );
237 m_reads += read_data1->
size();
255 log_error(stderr,
"caught a nvbio::bad_alloc exception:\n");
261 log_error(stderr,
"caught a nvbio::logic_error exception:\n");
267 log_error(stderr,
"caught a nvbio::runtime_error exception:\n");
271 catch (std::bad_alloc e)
273 log_error(stderr,
"caught a std::bad_alloc exception:\n");
277 catch (std::logic_error e)
279 log_error(stderr,
"caught a std::logic_error exception:\n");
283 catch (std::runtime_error e)
285 log_error(stderr,
"caught a std::runtime_error exception:\n");
291 log_error(stderr,
"caught an unknown exception!\n");
305 if (m_ready_pool1.empty() ==
false &&
306 m_ready_pool2.empty() ==
false)
309 std::pair<io::SequenceDataHost*,io::SequenceDataHost*> read_data;
310 read_data.first = m_ready_pool1.back(); m_ready_pool1.pop_back();
311 read_data.second = m_ready_pool2.back(); m_ready_pool2.pop_back();
312 if (offset) *offset = m_ready_poolN.back();
313 m_ready_poolN.pop_back();
318 if (offset) *offset = m_reads;
319 return std::pair<io::SequenceDataHost*,io::SequenceDataHost*>( NULL, NULL );
333 m_free_pool1.push( read_data.first );
334 m_free_pool2.push( read_data.second );