Public Member Functions | Data Fields

EThread Class Reference

Event System specific type of thread. More...

#include <I_EThread.h>

Inherits Thread.

Inherited by INKThreadInternal.

Collaboration diagram for EThread:
Collaboration graph
[legend]

Public Member Functions

Eventschedule_imm (Continuation *c, int callback_event=EVENT_IMMEDIATE, void *cookie=NULL)
 Schedules the continuation on this EThread to receive an event as soon as possible.
Eventschedule_imm_signal (Continuation *c, int callback_event=EVENT_IMMEDIATE, void *cookie=NULL)
Eventschedule_at (Continuation *c, ink_hrtime atimeout_at, int callback_event=EVENT_INTERVAL, void *cookie=NULL)
 Schedules the continuation on this EThread to receive an event at the given timeout.
Eventschedule_in (Continuation *c, ink_hrtime atimeout_in, int callback_event=EVENT_INTERVAL, void *cookie=NULL)
 Schedules the continuation on this EThread to receive an event after the timeout elapses.
Eventschedule_every (Continuation *c, ink_hrtime aperiod, int callback_event=EVENT_INTERVAL, void *cookie=NULL)
 Schedules the continuation on this EThread to receive an event periodically.
Eventschedule_imm_local (Continuation *c, int callback_event=EVENT_IMMEDIATE, void *cookie=NULL)
 Schedules the continuation on this EThread to receive an event as soon as possible.
Eventschedule_at_local (Continuation *c, ink_hrtime atimeout_at, int callback_event=EVENT_INTERVAL, void *cookie=NULL)
 Schedules the continuation on this EThread to receive an event at the given timeout.
Eventschedule_in_local (Continuation *c, ink_hrtime atimeout_in, int callback_event=EVENT_INTERVAL, void *cookie=NULL)
 Schedules the continuation on this EThread to receive an event after the timeout elapses.
Eventschedule_every_local (Continuation *c, ink_hrtime aperiod, int callback_event=EVENT_INTERVAL, void *cookie=NULL)
 Schedules the continuation on this EThread to receive an event periodically.
Eventschedule_local (Event *e)
 EThread ()
 EThread (ThreadType att, int anid)
 EThread (ThreadType att, Event *e)
virtual ~EThread ()
Eventschedule_spawn (Continuation *cont)
Eventschedule (Event *e, bool fast_signal=false)
 Que (Continuation, link) aio_ops
 Private Data for AIO.
bool is_event_type (EventType et)
void set_event_type (EventType et)
void execute ()
void process_event (Event *e, int calling_code)
void free_event (Event *e)

Data Fields

InkRand generator
char thread_private [PER_THREAD_DATA]
 Block of memory to allocate thread specific data e.g.
DiskHandler * diskHandler
 Private Data for the Disk Processor.
ProtectedQueue EventQueueExternal
PriorityEventQueue EventQueue
EThread ** ethreads_to_be_signalled
int n_ethreads_to_be_signalled
Eventaccept_event [MAX_ACCEPT_EVENTS]
int main_accept_index
int id
unsigned int event_types
void(* signal_hook )(EThread *)
int evpipe [2]
EventIOep
ThreadType tt
Eventoneevent
ServerSessionPoolserver_session_pool

Detailed Description

Event System specific type of thread.

The EThread class is the type of thread created and managed by the Event System. It is one of the available interfaces for schedulling events in the event system (another two are the Event and EventProcessor classes).

In order to handle events, each EThread object has two event queues, one external and one internal. The external queue is provided for users of the EThread (clients) to append events to that particular thread. Since it can be accessed by other threads at the same time, operations using it must proceed in an atomic fashion.

The internal queue, in the other hand, is used exclusively by the EThread to process timed events within a certain time frame. These events are queued internally and they may come from the external queue as well.

Scheduling Interface:

There are eight schedulling functions provided by EThread and they are a wrapper around their counterparts in EventProcessor.

See also:
EventProcessor
Event

Definition at line 87 of file I_EThread.h.


Constructor & Destructor Documentation

EThread::EThread (  ) 

Definition at line 42 of file UnixEThread.cc.

References PER_THREAD_DATA, and thread_private.

EThread::EThread ( ThreadType  att,
int  anid 
)
EThread::EThread ( ThreadType  att,
Event e 
)

Definition at line 93 of file UnixEThread.cc.

References DEDICATED, ink_assert, PER_THREAD_DATA, and thread_private.

EThread::~EThread (  )  [virtual]

Member Function Documentation

void EThread::execute (  )  [virtual]
TS_INLINE void EThread::free_event ( Event e  ) 
bool EThread::is_event_type ( EventType  et  ) 

Definition at line 119 of file UnixEThread.cc.

References event_types.

Referenced by UnixNetProcessor::connect_re_internal(), and net_accept().

void EThread::process_event ( Event e,
int  calling_code 
)
EThread::Que ( Continuation  ,
link   
)

Private Data for AIO.

Referenced by execute().

TS_INLINE Event * EThread::schedule ( Event e,
bool  fast_signal = false 
)
TS_INLINE Event * EThread::schedule_at ( Continuation c,
ink_hrtime  atimeout_at,
int  callback_event = EVENT_INTERVAL,
void *  cookie = NULL 
)

Schedules the continuation on this EThread to receive an event at the given timeout.

Forwards the request to the EventProcessor to schedule the callback to the continuation 'c' at the time specified in 'atimeout_at'. The event is assigned to this EThread.

Parameters:
c Continuation to be called back at the time specified in 'atimeout_at'.
atimeout_at Time value at which to callback.
callback_event Event code to be passed back to the continuation's handler. See the EventProcessor class.
cookie User-defined value or pointer to be passed back in the Event's object cookie field.
Returns:
A reference to an Event object representing the schedulling of this callback.

Definition at line 65 of file P_UnixEThread.h.

References Event::callback_event, Event::cookie, Thread::eventAllocator, Event::init(), and schedule().

TS_INLINE Event * EThread::schedule_at_local ( Continuation c,
ink_hrtime  atimeout_at,
int  callback_event = EVENT_INTERVAL,
void *  cookie = NULL 
)

Schedules the continuation on this EThread to receive an event at the given timeout.

Schedules the callback to the continuation 'c' at the time specified in 'atimeout_at'. The event is assigned to this EThread.

Parameters:
c Continuation to be called back at the time specified in 'atimeout_at'.
atimeout_at Time value at which to callback.
callback_event Event code to be passed back to the continuation's handler. See the EventProcessor class.
cookie User-defined value or pointer to be passed back in the Event's object cookie field.
Returns:
A reference to an Event object representing the schedulling of this callback.

Definition at line 115 of file P_UnixEThread.h.

References Event::callback_event, Event::cookie, EVENT_ALLOC, Thread::eventAllocator, Event::init(), and schedule_local().

TS_INLINE Event * EThread::schedule_every ( Continuation c,
ink_hrtime  aperiod,
int  callback_event = EVENT_INTERVAL,
void *  cookie = NULL 
)

Schedules the continuation on this EThread to receive an event periodically.

Schedules the callback to the continuation 'c' in the EventProcessor to occur every time 'aperiod' elapses. It is scheduled on this EThread.

Parameters:
c Continuation to call back everytime 'aperiod' elapses.
aperiod Duration of the time period between callbacks.
callback_event Event code to be passed back to the continuation's handler. See the Remarks section in the EventProcessor class.
cookie User-defined value or pointer to be passed back in the Event's object cookie field.
Returns:
A reference to an Event object representing the schedulling of this callback.

Definition at line 83 of file P_UnixEThread.h.

References Event::callback_event, Event::cookie, Thread::eventAllocator, Event::init(), ink_get_based_hrtime(), and schedule().

Referenced by NetAccept::init_accept(), NetAccept::init_accept_per_thread(), SSLNetAccept::init_accept_per_thread(), UDPReadContinuation::init_read(), initialize_thread_for_net(), initialize_thread_for_udp_net(), ClusterHandler::startClusterEvent(), and DNSHandler::startEvent().

TS_INLINE Event * EThread::schedule_every_local ( Continuation c,
ink_hrtime  aperiod,
int  callback_event = EVENT_INTERVAL,
void *  cookie = NULL 
)

Schedules the continuation on this EThread to receive an event periodically.

Schedules the callback to the continuation 'c' to occur every time 'aperiod' elapses. It is scheduled on this EThread.

Parameters:
c Continuation to call back everytime 'aperiod' elapses.
aperiod Duration of the time period between callbacks.
callback_event Event code to be passed back to the continuation's handler. See the Remarks section in the EventProcessor class.
cookie User-defined value or pointer to be passed back in the Event's object cookie field.
Returns:
A reference to an Event object representing the schedulling of this callback.

Definition at line 133 of file P_UnixEThread.h.

References Event::callback_event, Event::cookie, EVENT_ALLOC, Thread::eventAllocator, Event::init(), ink_get_based_hrtime(), and schedule_local().

TS_INLINE Event * EThread::schedule_imm ( Continuation c,
int  callback_event = EVENT_IMMEDIATE,
void *  cookie = NULL 
)

Schedules the continuation on this EThread to receive an event as soon as possible.

Forwards to the EventProcessor the schedule of the callback to the continuation 'c' as soon as possible. The event is assigned to EThread.

Parameters:
c Continuation to be called back as soon as possible.
callback_event Event code to be passed back to the continuation's handler. See the the EventProcessor class.
cookie User-defined value or pointer to be passed back in the Event's object cookie field.
Returns:
Reference to an Event object representing the schedulling of this callback.

Definition at line 47 of file P_UnixEThread.h.

References Event::callback_event, Event::cookie, Thread::eventAllocator, Event::init(), and schedule().

Referenced by PrefetchUrlBlaster::free(), get_hostinfo_ClusterFunction(), DNSProcessor::getby(), HostDBProcessor::getSRVbyname_imm(), PrefetchBlaster::init(), initialize_thread_for_net(), initialize_thread_for_udp_net(), DNSProcessor::open(), put_hostinfo_ClusterFunction(), register_ShowHostDB(), ShowNet::showConnections(), ShowNet::showConnectionsOnThread(), ShowNet::showSingleThread(), ShowNet::showThreads(), and CacheProcessor::start_internal().

TS_INLINE Event * EThread::schedule_imm_local ( Continuation c,
int  callback_event = EVENT_IMMEDIATE,
void *  cookie = NULL 
)

Schedules the continuation on this EThread to receive an event as soon as possible.

Schedules the callback to the continuation 'c' as soon as possible. The event is assigned to this EThread.

Parameters:
c Continuation to be called back as soon as possible.
callback_event Event code to be passed back to the continuation's handler. See the EventProcessor class.
cookie User-defined value or pointer to be passed back in the Event's object cookie field.
Returns:
A reference to an Event object representing the schedulling of this callback.

Definition at line 106 of file P_UnixEThread.h.

References Event::callback_event, Event::cookie, EVENT_ALLOC, Thread::eventAllocator, Event::init(), and schedule_local().

Referenced by PrefetchBlaster::handleEvent(), and PrefetchTransform::~PrefetchTransform().

TS_INLINE Event * EThread::schedule_imm_signal ( Continuation c,
int  callback_event = EVENT_IMMEDIATE,
void *  cookie = NULL 
)
TS_INLINE Event * EThread::schedule_in ( Continuation c,
ink_hrtime  atimeout_in,
int  callback_event = EVENT_INTERVAL,
void *  cookie = NULL 
)

Schedules the continuation on this EThread to receive an event after the timeout elapses.

Instructs the EventProcessor to schedule the callback to the continuation 'c' after the time specified in atimeout_in elapses. The event is assigned to this EThread.

Parameters:
c Continuation to be called back after the timeout elapses.
atimeout_in Amount of time after which to callback.
callback_event Event code to be passed back to the continuation's handler. See the EventProcessor class.
cookie User-defined value or pointer to be passed back in the Event's object cookie field.
Returns:
A reference to an Event object representing the schedulling of this callback.

Definition at line 74 of file P_UnixEThread.h.

References Event::callback_event, Event::cookie, Thread::eventAllocator, Event::init(), ink_get_based_hrtime(), and schedule().

Referenced by UnixNetVConnection::acceptEvent(), HostDBContinuation::dnsEvent(), HostDBContinuation::do_dns(), HostDBContinuation::do_get_response(), HostDBProcessor::getbyname_imm(), HostDBProcessor::getSRVbyname_imm(), PrefetchBlaster::handleEvent(), BlasterUrlList::handleEvent(), SocksEntry::init(), KeepAliveLockHandler::init(), SocksProxy::mainEvent(), SocksEntry::mainEvent(), CacheSync::mainEvent(), HostDBContinuation::probeEvent(), UnixNetVConnection::set_active_timeout(), ClusterVConnectionBase::set_active_timeout(), UnixNetVConnection::set_enabled(), UnixNetVConnection::set_inactivity_timeout(), ClusterVConnectionBase::set_inactivity_timeout(), HostDBProcessor::setby(), ShowNet::showConnectionsOnThread(), ShowNet::showSingleThread(), OpenDir::signal_readers(), ClusterVConnection::start(), ClusterHandler::startClusterEvent(), and SocksEntry::startEvent().

TS_INLINE Event * EThread::schedule_in_local ( Continuation c,
ink_hrtime  atimeout_in,
int  callback_event = EVENT_INTERVAL,
void *  cookie = NULL 
)

Schedules the continuation on this EThread to receive an event after the timeout elapses.

Schedules the callback to the continuation 'c' after the time specified in atimeout_in elapses. The event is assigned to this EThread.

Parameters:
c Continuation to be called back after the timeout elapses.
atimeout_in Amount of time after which to callback.
callback_event Event code to be passed back to the continuation's handler. See the Remarks section in the EventProcessor class.
cookie User-defined value or pointer to be passed back in the Event's object cookie field.
Returns:
A reference to an Event object representing the schedulling of this callback.

Definition at line 124 of file P_UnixEThread.h.

References Event::callback_event, Event::cookie, EVENT_ALLOC, Thread::eventAllocator, Event::init(), ink_get_based_hrtime(), and schedule_local().

Referenced by net_activity(), UnixNetVConnection::set_active_timeout(), UnixNetVConnection::set_enabled(), and UnixNetVConnection::set_inactivity_timeout().

TS_INLINE Event * EThread::schedule_local ( Event e  ) 
TS_INLINE Event * EThread::schedule_spawn ( Continuation cont  ) 

Definition at line 40 of file P_UnixEThread.h.

References EVENT_ALLOC, Thread::eventAllocator, Event::init(), and schedule().

void EThread::set_event_type ( EventType  et  ) 

Definition at line 125 of file UnixEThread.cc.

References event_types.

Referenced by EventProcessor::spawn_event_threads(), and EventProcessor::start().


Field Documentation

Event* EThread::accept_event[MAX_ACCEPT_EVENTS]

Definition at line 300 of file I_EThread.h.

DiskHandler* EThread::diskHandler

Private Data for the Disk Processor.

Definition at line 289 of file I_EThread.h.

Referenced by CacheProcessor::start_internal().

Definition at line 320 of file I_EThread.h.

Referenced by initialize_thread_for_net(), and net_signal_hook_function().

Definition at line 297 of file I_EThread.h.

Referenced by ProtectedQueue::enqueue(), EThread(), flush_signals(), and ~EThread().

unsigned int EThread::event_types

Definition at line 304 of file I_EThread.h.

Referenced by is_event_type(), set_event_type(), and TSThreadCreate().

Definition at line 301 of file I_EThread.h.

Definition at line 298 of file I_EThread.h.

Referenced by ProtectedQueue::enqueue(), execute(), flush_signals(), and ~EThread().

Definition at line 323 of file I_EThread.h.

Referenced by execute().

char EThread::thread_private[PER_THREAD_DATA]

Block of memory to allocate thread specific data e.g.

stat system arrays.

Definition at line 286 of file I_EThread.h.

Referenced by EThread().


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