Page Speed Optimization Libraries
1.13.35.1
|
#include "queued_worker_pool.h"
Classes | |
class | AddFunction |
Public Member Functions | |
void | Add (Function *function) LOCKS_EXCLUDED(sequence_mutex_) |
void | set_queue_size_stat (Waveform *x) |
void | set_max_queue_size (size_t x) |
void | CancelPendingFunctions () LOCKS_EXCLUDED(sequence_mutex_) |
Calls Cancel on all pending functions in the queue. | |
Friends | |
class | QueuedWorkerPool |
Functions added to a Sequence will be run sequentially, though not necessarily always from the same worker thread. The scheduler will continue to schedule new work added to the sequence until FreeSequence is called.
|
virtual |
Adds 'function' to a sequence. Note that this can occur at any time the sequence is live – you can add functions to a sequence that has already started processing.
'function' can be called any time after Add(), and may in fact be called before Add() returns.
Ownership of 'function' is transferred to the Sequence, which deletes it after execution or upon cancellation due to shutdown.
If the pool is being shut down at the time Add is being called, this method will call function->Cancel().
Implements net_instaweb::Sequence.
|
inline |
Sets the maximum number of functions that can be enqueued to a sequence. By default, sequences are unbounded. When a bound is reached, the oldest functions are retired by calling Cancel() on them.