@@ -27,7 +27,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
27
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
28
*/
29
29
30
- #include < DataFrame/Threads/ThreadPool.h>
30
+ #include < DataFrame/Utils/ Threads/ThreadPool.h>
31
31
32
32
#include < chrono>
33
33
#include < cstdlib>
@@ -185,9 +185,9 @@ ThreadPool::parallel_loop(I begin, I end, F &&routine, As && ... args) {
185
185
186
186
// ----------------------------------------------------------------------------
187
187
188
- template <std::random_access_iterator I, std:: size_t TH>
188
+ template <std::random_access_iterator I, long TH>
189
189
void
190
- ThreadPool::parallel_sort (I begin, I end) {
190
+ ThreadPool::parallel_sort (const I begin, const I end) {
191
191
192
192
using value_type = typename std::iterator_traits<I>::value_type;
193
193
@@ -198,20 +198,20 @@ ThreadPool::parallel_sort(I begin, I end) {
198
198
199
199
// ----------------------------------------------------------------------------
200
200
201
- template <std::random_access_iterator I, typename P, std:: size_t TH>
201
+ template <std::random_access_iterator I, typename P, long TH>
202
202
void
203
- ThreadPool::parallel_sort (I begin, I end, P compare) {
203
+ ThreadPool::parallel_sort (const I begin, const I end, P compare) {
204
204
205
205
using value_type = typename std::iterator_traits<I>::value_type;
206
206
using fut_type = std::future<void >;
207
207
208
208
if (begin >= end) return ;
209
209
210
- const std:: size_t data_size = std::distance (begin, end);
210
+ const size_type data_size = std::distance (begin, end);
211
211
212
212
if (data_size > 0 ) {
213
213
auto left_iter = begin;
214
- auto right_iter = end;
214
+ auto right_iter = end - 1 ;
215
215
bool is_swapped_left = false ;
216
216
bool is_swapped_right = false ;
217
217
const value_type pivot = *begin;
@@ -246,7 +246,7 @@ ThreadPool::parallel_sort(I begin, I end, P compare) {
246
246
&ThreadPool::parallel_sort<I, P, TH>,
247
247
this ,
248
248
begin,
249
- left_iter - 1 ,
249
+ left_iter,
250
250
compare);
251
251
if (do_right)
252
252
right_fut = dispatch (false ,
@@ -267,7 +267,7 @@ ThreadPool::parallel_sort(I begin, I end, P compare) {
267
267
}
268
268
else {
269
269
if (do_left)
270
- parallel_sort<I, P, TH>(begin, left_iter - 1 , compare);
270
+ parallel_sort<I, P, TH>(begin, left_iter, compare);
271
271
272
272
if (do_right)
273
273
parallel_sort<I, P, TH>(right_iter + 1 , end, compare);
0 commit comments