Skip to content

Commit cfae18a

Browse files
committed
Misc[BMQC]: replace Bind with functor
When bdlf::Bind is used the stack traces contain frames for each argument invokation. It might be simplified by using functor instead. Signed-off-by: Evgeny Malygin <emalygin@bloomberg.net>
1 parent f111765 commit cfae18a

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,21 @@ class MultiQueueThreadPool BSLS_KEYWORD_FINAL {
300300
e_MONITOR_STUCK
301301
};
302302

303+
/// The thread functor.
304+
struct ProcessQueueJob {
305+
ThisClass* d_pool_p;
306+
int d_queueId;
307+
308+
explicit ProcessQueueJob(ThisClass* pool, int queueId)
309+
: d_pool_p(pool)
310+
, d_queueId(queueId)
311+
{
312+
// NOTHING
313+
}
314+
315+
void operator()() const { d_pool_p->processQueue(d_queueId); }
316+
};
317+
303318
struct QueueInfo {
304319
// PUBLIC DATA
305320
/// Pointer to the queue
@@ -731,9 +746,7 @@ inline int MultiQueueThreadPool<TYPE>::start()
731746
// Set up threads
732747
for (size_t i = 0; i < d_queues.size(); ++i) {
733748
BSLA_MAYBE_UNUSED const int rc = d_config.d_threadPool_p->enqueueJob(
734-
bdlf::BindUtil::bind(&ThisClass::processQueue,
735-
this,
736-
static_cast<int>(i)));
749+
ThisClass::ProcessQueueJob(this, static_cast<int>(i)));
737750
BSLS_ASSERT_SAFE(rc == 0);
738751
}
739752

0 commit comments

Comments
 (0)