@@ -338,7 +338,7 @@ struct prong {
338
338
constexpr prong &operator =(prong &&) = default ;
339
339
constexpr prong &operator =(prong const &) = default ;
340
340
341
- explicit prong (task_index_t task, thread_index_t thread = 0 ) noexcept : task(task), thread(thread) {}
341
+ explicit prong (task_index_t task, thread_index_t thread) noexcept : task(task), thread(thread) {}
342
342
343
343
inline operator task_index_t () const noexcept { return task; }
344
344
};
@@ -365,7 +365,7 @@ struct colocated_prong {
365
365
constexpr colocated_prong &operator =(colocated_prong const &) = default ;
366
366
constexpr colocated_prong &operator =(colocated_prong &&) = default ;
367
367
368
- explicit colocated_prong (task_index_t task, thread_index_t thread = 0 , colocation_index_t colocation = 0 ) noexcept
368
+ explicit colocated_prong (task_index_t task, thread_index_t thread, colocation_index_t colocation) noexcept
369
369
: task(task), thread(thread), colocation(colocation) {}
370
370
371
371
colocated_prong (prong<index_t > const &prong) noexcept : task(prong.task), thread(prong.thread), colocation(0 ) {}
@@ -394,7 +394,7 @@ struct colocated_thread {
394
394
constexpr colocated_thread &operator =(colocated_thread const &) = default ;
395
395
constexpr colocated_thread &operator =(colocated_thread &&) = default ;
396
396
397
- explicit colocated_thread (thread_index_t thread, colocation_index_t colocation = 0 ) noexcept
397
+ explicit colocated_thread (thread_index_t thread, colocation_index_t colocation) noexcept
398
398
: thread(thread), colocation(colocation) {}
399
399
400
400
inline operator thread_index_t () const noexcept { return thread; }
@@ -641,6 +641,9 @@ struct indexed_split {
641
641
return {begin, count};
642
642
}
643
643
644
+ inline index_t smallest_size () const noexcept { return quotient_; }
645
+ inline index_t largest_size () const noexcept { return quotient_ + (remainder_ > 0 ); }
646
+
644
647
private:
645
648
index_t quotient_ {0 };
646
649
index_t remainder_ {0 };
@@ -1336,7 +1339,7 @@ class basic_pool {
1336
1339
template <typename fork_type_>
1337
1340
static void _call_as_lambda (punned_fork_context_t punned_lambda_pointer, thread_index_t thread_index) noexcept {
1338
1341
fork_type_ &lambda_object = *static_cast <fork_type_ *>(punned_lambda_pointer);
1339
- lambda_object (colocated_thread_t {thread_index});
1342
+ lambda_object (colocated_thread_t {thread_index, 0 });
1340
1343
}
1341
1344
1342
1345
/* *
@@ -2442,6 +2445,7 @@ struct linux_colocated_pool {
2442
2445
using epoch_index_t = index_t ; // ? A.k.a. number of previous API calls in [0, UINT_MAX)
2443
2446
using thread_index_t = index_t ; // ? A.k.a. "core index" or "thread ID" in [0, threads_count)
2444
2447
using colocated_thread_t = colocated_thread<thread_index_t >;
2448
+ using prong_t = colocated_prong<index_t >;
2445
2449
2446
2450
using punned_fork_context_t = void *; // ? Pointer to the on-stack lambda
2447
2451
using trampoline_t = void (*)(punned_fork_context_t , colocated_thread_t ); // ? Wraps lambda's `operator()`
0 commit comments