# Gio::ThreadedSocketService Class Reference
[Portable Network I/O Functionality]

A threaded GSocketService. More...

`#include <giomm/threadedsocketservice.h>`

Inheritance diagram for Gio::ThreadedSocketService:
[legend]

List of all members.

## Public Member Functions
virtual | ~ThreadedSocketService ()
GThreadedSocketService* | gobj ()
| Provides access to the underlying C GObject.
const GThreadedSocketService* | gobj () const
| Provides access to the underlying C GObject.
GThreadedSocketService* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::SignalProxy2< bool, const Glib::RefPtr < SocketConnection >&, const Glib::RefPtr< Glib::Object >& > | signal_run ()
Glib::PropertyProxy_ReadOnly< int > | property_max_threads () const
| The max number of threads handling clients for this service.
## Static Public Member Functions
static Glib::RefPtr < ThreadedSocketService > | create (int max_threads)
## Protected Member Functions
| ThreadedSocketService (int max_threads)
virtual bool | on_run (const Glib::RefPtr< SocketConnection >& connection, const Glib::RefPtr< Glib::Object >& source_object)
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr < Gio::ThreadedSocketService > | wrap (GThreadedSocketService* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A threaded GSocketService.

A ThreadedSocketService is a simple subclass of SocketService 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 availible to serve incomming 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.

Since glibmm 2.24:

## Constructor & Destructor Documentation

virtual Gio::ThreadedSocketService::~ThreadedSocketService | ( |  | ) | `[virtual]`

Gio::ThreadedSocketService::ThreadedSocketService | ( | int | max_threads | ) | `[explicit, protected]`

## Member Function Documentation

static Glib::RefPtr<ThreadedSocketService> Gio::ThreadedSocketService::create | ( | int | max_threads | ) | `[static]`

const GThreadedSocketService* Gio::ThreadedSocketService::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::SocketService.

GThreadedSocketService* Gio::ThreadedSocketService::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::SocketService.

GThreadedSocketService* Gio::ThreadedSocketService::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gio::SocketService.

virtual bool Gio::ThreadedSocketService::on_run | ( | const Glib::RefPtr< SocketConnection >& | connection,
|  | const Glib::RefPtr< Glib::Object >& | source_object |
| ) |  |  | `[protected, virtual]`

Glib::PropertyProxy_ReadOnly<int> Gio::ThreadedSocketService::property_max_threads | ( |  | ) | const

The max number of threads handling clients for this service.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::SignalProxy2< bool,const Glib::RefPtr<SocketConnection>&,const Glib::RefPtr<Glib::Object>& > Gio::ThreadedSocketService::signal_run | ( |  | ) |

Prototype:
  `bool on_my_run(const Glib::RefPtr<SocketConnection>& connection, const Glib::RefPtr<Glib::Object>& source_object)`

## Friends And Related Function Documentation

Glib::RefPtr< Gio::ThreadedSocketService > wrap | ( | GThreadedSocketService * | object,
|  | bool | take_copy = `false` |
| ) |  |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  | object | The C instance.
  | take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.