MySQL 8.0.40
Source Code Documentation
HttpRequestThread Class Reference

base class of all http request handler threads More...

#include <http_server_plugin.h>

Inheritance diagram for HttpRequestThread:
[legend]

Public Types

using native_handle_type = EventBaseSocket
 

Public Member Functions

 HttpRequestThread ()
 
 HttpRequestThread (HttpRequestThread &&object)
 
native_handle_type get_socket_fd ()
 
void accept_socket ()
 
void set_request_router (HttpRequestRouter &router)
 
void wait_and_dispatch ()
 
void break_dispatching ()
 
void wait_until_ready ()
 

Protected Member Functions

bool is_initalized () const
 
void initialization_finished ()
 

Static Protected Member Functions

static void on_event_loop_ready (native_handle_type, short, void *)
 

Protected Attributes

EventBase event_base_
 
EventHttp event_http_ {&event_base_}
 
native_handle_type accept_fd_ {kEventBaseInvalidSocket}
 
WaitableMonitor< bool > initialized_ {false}
 

Detailed Description

base class of all http request handler threads

  • HttpRequestMainThread opens the socket, and accepts and handles connections
  • HttpRequestWorkerThread accepts and handles connections, using the socket listened by the main-thread

As all threads can accept in parallel this may lead to a thundering herd problem and quite likely it is better to let only one thread accept() and push the socket handling into async-deque and let all workers steal from the queue

Member Typedef Documentation

◆ native_handle_type

Constructor & Destructor Documentation

◆ HttpRequestThread() [1/2]

HttpRequestThread::HttpRequestThread ( )
inline

◆ HttpRequestThread() [2/2]

HttpRequestThread::HttpRequestThread ( HttpRequestThread &&  object)
inline

Member Function Documentation

◆ accept_socket()

void HttpRequestThread::accept_socket ( )

◆ break_dispatching()

void HttpRequestThread::break_dispatching ( )

◆ get_socket_fd()

native_handle_type HttpRequestThread::get_socket_fd ( )
inline

◆ initialization_finished()

void HttpRequestThread::initialization_finished ( )
protected

◆ is_initalized()

bool HttpRequestThread::is_initalized ( ) const
protected

◆ on_event_loop_ready()

void HttpRequestThread::on_event_loop_ready ( native_handle_type  ,
short  ,
void *  ctxt 
)
staticprotected

◆ set_request_router()

void HttpRequestThread::set_request_router ( HttpRequestRouter router)

◆ wait_and_dispatch()

void HttpRequestThread::wait_and_dispatch ( )

◆ wait_until_ready()

void HttpRequestThread::wait_until_ready ( )

Member Data Documentation

◆ accept_fd_

native_handle_type HttpRequestThread::accept_fd_ {kEventBaseInvalidSocket}
protected

◆ event_base_

EventBase HttpRequestThread::event_base_
protected

◆ event_http_

EventHttp HttpRequestThread::event_http_ {&event_base_}
protected

◆ initialized_

WaitableMonitor<bool> HttpRequestThread::initialized_ {false}
protected

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