Gio.ThreadedSocketService

const Gio = imports.gi.Gio;

let threadedSocketService = new Gio.ThreadedSocketService({
    max_threads: value,
});
  

A Gio.ThreadedSocketService is a simple subclass of Gio.SocketService that handles incoming connections by creating a worker thread and dispatching the connection to it by emitting the Gio.ThreadedSocketService::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 Gio.SocketService from 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.

Since 2.22

Hierarchy

  • GObject.Object
    • Gio.SocketListener
      • Gio.SocketService
        • Gio.ThreadedSocketService