MySQL 8.2.0
Source Code Documentation
EventBase Class Reference

Main event registration and dispatch engine More...

#include <http_common.h>


struct  impl

Public Types

using SocketHandle = EventBaseSocket
using CallbackEvent = void(*)(SocketHandle, short, void *)

Public Member Functions

 EventBase ()
 EventBase (EventBase &&event)
 ~EventBase ()
bool once (const SocketHandle fd, const EventFlags::Bitset events, CallbackEvent cb, void *arg, const struct timeval *tv)
 Register new event notification. More...
bool loop_exit (const struct timeval *tv)
 Stop dispatching. More...
int dispatch ()
 Wait for registered notifications, and when they become active dispatch them. More...

Private Member Functions

 EventBase (std::unique_ptr< impl > &&pImpl)

Private Attributes

std::unique_ptr< implpImpl_


class EventHttp
class EventBuffer

Detailed Description

Main event registration and dispatch engine

Wrapper for event_base structure from libevent.

Member Typedef Documentation

◆ CallbackEvent

using EventBase::CallbackEvent = void (*)(SocketHandle, short, void *)

◆ SocketHandle

Constructor & Destructor Documentation

◆ EventBase() [1/3]

EventBase::EventBase ( )

◆ EventBase() [2/3]

EventBase::EventBase ( EventBase &&  event)

◆ ~EventBase()

EventBase::~EventBase ( )

◆ EventBase() [3/3]

EventBase::EventBase ( std::unique_ptr< impl > &&  pImpl)

Member Function Documentation

◆ dispatch()

int EventBase::dispatch ( )

Wait for registered notifications, and when they become active dispatch them.

If there is no event registered return.

0 if successful, -1 if an error occurred, or 1 if we exited because no events were pending or active.

◆ loop_exit()

bool EventBase::loop_exit ( const struct timeval *  tv)

Stop dispatching.

While some thread is blocked inside dispatch method, some other thread might call this function to notify and break the dispatching loop inside dispatch.

Return values
falseif breaking the loop fails
trueif event breaking the loop was scheduled

◆ once()

bool EventBase::once ( const SocketHandle  fd,
const EventFlags::Bitset  events,
CallbackEvent  cb,
void *  arg,
const struct timeval *  tv 

Register new event notification.

Depending on arguments, the function may register notification for: socket read/write, timeout, signal handler.

Return values
falseif registration fails
trueif event was scheduled

Friends And Related Function Documentation

◆ EventBuffer

friend class EventBuffer

◆ EventHttp

friend class EventHttp

Member Data Documentation

◆ pImpl_

std::unique_ptr<impl> EventBase::pImpl_

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