Gio.ThreadedSocketService¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | Gio.SocketService (4), Gio.SocketListener (13), GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | new(max_threads) | 
Virtual Methods¶
| Inherited: | Gio.SocketService (1), Gio.SocketListener (2), GObject.Object (7) | 
|---|
| do_run(connection, source_object) | 
Properties¶
| Inherited: | Gio.SocketService (1), Gio.SocketListener (1) | 
|---|
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| max-threads | int | r/w/co | The max number of threads handling clients for this service | 
Signals¶
| Inherited: | Gio.SocketService (1), Gio.SocketListener (1), GObject.Object (1) | 
|---|
| Name | Short Description | 
|---|---|
| run | The ::runsignal is emitted in a worker thread in response to an incoming connection. | 
Fields¶
| Inherited: | Gio.SocketService (1), Gio.SocketListener (1), GObject.Object (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| parent_instance | Gio.SocketService | r | 
Class Details¶
- 
class Gio.ThreadedSocketService(**kwargs)¶
- Bases: - Gio.SocketService- Abstract: - No - Structure: - Gio.ThreadedSocketServiceClass- A - Gio.ThreadedSocketServiceis a simple subclass of- Gio.SocketServicethat handles incoming connections by creating a worker thread and dispatching the connection to it by emitting the- Gio.ThreadedSocketService- ::runsignal 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 - Gio.SocketServicefrom accepting new connections when all threads are busy.- As with - Gio.SocketService, you may connect to- Gio.ThreadedSocketService- ::run, or subclass and override the default handler.- New in version 2.22. - 
classmethod new(max_threads)[source]¶
- Parameters: - max_threads ( - int) – the maximal number of threads to execute concurrently handling incoming clients, -1 means no limit- Returns: - a new - Gio.SocketService.- Return type: - Gio.SocketService- Creates a new - Gio.ThreadedSocketServicewith no listeners. Listeners must be added with one of the- Gio.SocketListener“add” methods.- New in version 2.22. 
 - 
do_run(connection, source_object) virtual¶
- Parameters: - connection (Gio.SocketConnection) –
- source_object (GObject.Object) –
 - Return type: 
- connection (
 
- 
classmethod 
Signal Details¶
- 
Gio.ThreadedSocketService.signals.run(threaded_socket_service, connection, source_object)¶
- Signal Name: - run- Flags: - Parameters: - threaded_socket_service (Gio.ThreadedSocketService) – The object which received the signal
- connection (Gio.SocketConnection) – a newGio.SocketConnectionobject.
- source_object (GObject.ObjectorNone) – the source_object passed toGio.SocketListener.add_address().
 - Returns: - Trueto stop further signal handlers from being called- Return type: - The - ::runsignal 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.
- threaded_socket_service (