BloombergLP::bdlmt::MultiQueueThreadPool_Queue::enqueueDeletion

Disable this queue and schedule its deletion.

Synopsis

Declared in <bdlmt_multiqueuethreadpool.h>

bool
enqueueDeletion(
    Job const& cleanupFunctor = Job(),
    bslmt::Latch* completionSignal = 0);

Description

Permanently disable enqueueing from this queue, and enqueue a job that will delete this queue. Optionally specify cleanupFunctor, which, if supplied, will be invoked immediately prior to this queue's deletion. Optionally specify completionSignal, on which (if the calling thread is not processing a job - or batch of jobs - for this queue) to invoke arrive when the queue is deleted. Return true if the current thread is the thread processing a job (or batch of jobs), and false otherwise. Note that if completionSignal is supplied, a return status of false typically indicates that completionSignal->wait() should be invoked from the calling function', while a return status of true indicates this is an attempt to delete the queue from within a job being processed on the queue (so waiting on the queue's deletion would result in a dead-lock).

Return Value

true if the current thread is processing a job for this queue, and false otherwise

Parameters

NameDescription
cleanupFunctoroptional functor invoked before queue deletion
completionSignaloptional latch signaled when the queue is deleted