Page Speed Optimization Libraries
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Member Functions | Friends | List of all members
net_instaweb::QueuedWorkerPool::Sequence Class Reference

#include "queued_worker_pool.h"

Inheritance diagram for net_instaweb::QueuedWorkerPool::Sequence:


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.


class QueuedWorkerPool

Detailed Description

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.

TODO(jmarantz): Make this subclass private (or just move it to the .cc file) and change NewSequence to return a net_instaweb::Sequence*.

Member Function Documentation

void net_instaweb::QueuedWorkerPool::Sequence::Add ( Function function)

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.

void net_instaweb::QueuedWorkerPool::Sequence::set_max_queue_size ( size_t  x)

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.

The documentation for this class was generated from the following file: