Gio.ThreadedSocketService¶
class — extends SocketService
A GThreadedSocketService is a simple subclass of SocketService
that handles incoming connections by creating a worker thread and
dispatching the connection to it by emitting the
[signalGio.ThreadedSocketService::run signal] in the new thread.
The signal handler may perform blocking I/O 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 SocketService from accepting
new connections when all threads are busy.
As with SocketService, you may connect to
ThreadedSocketService.run, or subclass and override the default
handler.
Constructors¶
new¶
Creates a new ThreadedSocketService with no listeners. Listeners
must be added with one of the SocketListener "add" methods.
Parameters:
max_threads— the maximal number of threads to execute concurrently handling incoming clients, -1 means no limit
Virtual methods¶
do_run¶
Properties¶
max_threads¶
The maximum number of threads handling clients for this service.
Signals¶
run¶
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.