Public Member Functions | Protected Member Functions

Processor Class Reference

Base class for all of the IO Core processors. More...

#include <I_Processor.h>

Inherited by CacheProcessor, DNSProcessor, EventProcessor, HostDBProcessor, NetProcessor, RemapProcessor, TasksProcessor, and UDPNetProcessor.

Public Member Functions

virtual ~Processor ()
virtual Threadcreate_thread (int thread_index)
 Returns a Thread appropriate for the processor.
virtual int get_thread_count ()
 Returns the number of threads required for this processor.
virtual void shutdown ()
 This function attemps to stop the processor.
virtual int start (int number_of_threads, size_t stacksize=DEFAULT_STACKSIZE)
 Starts execution of the processor.

Protected Member Functions

 Processor ()

Detailed Description

Base class for all of the IO Core processors.

The Processor class defines a common interface for all the processors in the IO Core. A processor is multithreaded subsystem specialized in some type of task or application. For example, the Event System module includes the EventProcessor which provides schedulling services, the Net module includes the NetProcessor which provides networking services, etc.

You cannot create objects of the Processor class and its methods have no implementation. Therefore, you are expected to use objects of a derived type.

Most of such derived classes, provide a singleton object and is common case to have a single instance in that application scope.

Definition at line 56 of file I_Processor.h.


Constructor & Destructor Documentation

Processor::~Processor (  )  [virtual]

Definition at line 65 of file Processor.cc.

Processor::Processor (  )  [protected]

Definition at line 52 of file Processor.cc.


Member Function Documentation

Thread * Processor::create_thread ( int  thread_index  )  [virtual]

Returns a Thread appropriate for the processor.

Returns a new instance of a Thread or Thread derived class of a thread which is the thread class for the processor.

Parameters:
thread_index reserved for future use.

Definition at line 75 of file Processor.cc.

References ink_release_assert.

int Processor::get_thread_count (  )  [virtual]

Returns the number of threads required for this processor.

If the number is not defined or not used, it is equal to 0.

Definition at line 87 of file Processor.cc.

virtual void Processor::shutdown (  )  [inline, virtual]

This function attemps to stop the processor.

Please refer to the documentation on each processor to determine if it is supported.

Reimplemented in EventProcessor.

Definition at line 85 of file I_Processor.h.

virtual int Processor::start ( int  number_of_threads,
size_t  stacksize = DEFAULT_STACKSIZE 
) [inline, virtual]

Starts execution of the processor.

Attempts to start the number of threads specified for the processor, initializes their states and sets them running. On failure it returns a negative value.

Parameters:
number_of_threads Positive value indicating the number of threads to spawn for the processor.
stacksize The thread stack size to use for this processor.

Reimplemented in CacheProcessor, DNSProcessor, EventProcessor, TasksProcessor, HostDBProcessor, NetProcessor, UDPNetProcessor, SSLNetProcessor, UDPNetProcessorInternal, UnixNetProcessor, and RemapProcessor.

Definition at line 101 of file I_Processor.h.


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