Sponge
CS144's user-space TCP library
Public Member Functions | Public Attributes | List of all members
EventLoop::Rule Class Reference

Specifies a condition and callback that an EventLoop should handle. More...

Public Member Functions

unsigned int service_count () const
 

Public Attributes

CallbackT callback
 A callback that reads or writes fd. More...
 
CallbackT cancel
 A callback that is called when the rule is cancelled (e.g. on hangup) More...
 
Direction direction
 Direction::In for reading from fd, Direction::Out for writing to fd. More...
 
FileDescriptor fd
 FileDescriptor to monitor for activity. More...
 
InterestT interest
 A callback that returns true whenever fd should be polled. More...
 

Detailed Description

Specifies a condition and callback that an EventLoop should handle.

Created by calling EventLoop::add_rule() or EventLoop::add_cancelable_rule().

Definition at line 26 of file eventloop.hh.

Member Function Documentation

◆ service_count()

unsigned int EventLoop::Rule::service_count ( ) const

Returns the number of times fd has been read or written, depending on the value of Rule::direction.

This function is used internally by EventLoop; you will not need to call it

Definition at line 13 of file eventloop.cc.

Member Data Documentation

◆ callback

CallbackT EventLoop::Rule::callback

A callback that reads or writes fd.

Definition at line 30 of file eventloop.hh.

◆ cancel

CallbackT EventLoop::Rule::cancel

A callback that is called when the rule is cancelled (e.g. on hangup)

Definition at line 32 of file eventloop.hh.

◆ direction

Direction EventLoop::Rule::direction

Direction::In for reading from fd, Direction::Out for writing to fd.

Definition at line 29 of file eventloop.hh.

◆ fd

FileDescriptor EventLoop::Rule::fd

FileDescriptor to monitor for activity.

Definition at line 28 of file eventloop.hh.

◆ interest

InterestT EventLoop::Rule::interest

A callback that returns true whenever fd should be polled.

Definition at line 31 of file eventloop.hh.


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