ThreadedSocketService

A GThreadedSocketService is a simple subclass of GSocketService that handles incoming connections by creating a worker thread and dispatching the connection to it by emitting the run signal in the new thread.

The signal handler may perform blocking IO and need not return until the connection is closed.

The service is implemented using a thread pool, so there is a limited amount of threads available to serve incoming requests. The service automatically stops the GSocketService from accepting new connections when all threads are busy.

As with GSocketService, you may connect to run, or subclass and override the default handler.

Constructors

this
this(GThreadedSocketService* gThreadedSocketService, bool ownedRef = false)

Sets our main struct and passes it to the parent class.

this
this(int maxThreads)

Creates a new GThreadedSocketService with no listeners. Listeners must be added with one of the GSocketListener "add" methods.

Members

Functions

addOnRun
gulong addOnRun(bool delegate(SocketConnection, ObjectG, ThreadedSocketService) dlg, ConnectFlags connectFlags = cast(ConnectFlags)0)

The ::run signal is emitted in a worker thread in response to an incoming connection. This thread is dedicated to handling connection and may perform blocking IO. The signal handler need not return until the connection is closed.

getStruct
void* getStruct()

the main Gtk struct as a void*

getThreadedSocketServiceStruct
GThreadedSocketService* getThreadedSocketServiceStruct(bool transferOwnership = false)

Get the main Gtk struct

Static functions

getType
GType getType()

Variables

gThreadedSocketService
GThreadedSocketService* gThreadedSocketService;

the main Gtk struct

Meta

Since

2.22