Blame docs/reference/gio/html/GThreadedSocketService.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>GThreadedSocketService: GIO Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GIO Reference Manual">
Packit ae235b
<link rel="up" href="highlevel-socket.html" title="High-level network functionallity">
Packit ae235b
<link rel="prev" href="GSocketService.html" title="GSocketService">
Packit ae235b
<link rel="next" href="GNetworkMonitor.html" title="GNetworkMonitor">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description  | 
Packit ae235b
                  Object Hierarchy  | 
Packit ae235b
                  Properties  | 
Packit ae235b
                  Signals
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

GThreadedSocketService

Packit ae235b

GThreadedSocketService — A threaded GSocketService

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GSocketService *
Packit ae235b
Packit ae235b
Packit ae235b
g_threaded_socket_service_new ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Properties

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gint
Packit ae235b
max-threads
Packit ae235b
Read / Write / Construct Only
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Signals

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gboolean
Packit ae235b
run
Packit ae235b
Run Last
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
 
Packit ae235b
GThreadedSocketService
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Object Hierarchy

Packit ae235b
    GObject
Packit ae235b
    ╰── GSocketListener
Packit ae235b
        ╰── GSocketService
Packit ae235b
            ╰── GThreadedSocketService
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <gio/gio.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

A GThreadedSocketService is a simple subclass of GSocketService

Packit ae235b
that handles incoming connections by creating a worker thread and
Packit ae235b
dispatching the connection to it by emitting the
Packit ae235b
“run” signal in the new thread.

Packit ae235b

The signal handler may perform blocking IO and need not return

Packit ae235b
until the connection is closed.

Packit ae235b

The service is implemented using a thread pool, so there is a

Packit ae235b
limited amount of threads available to serve incoming requests.
Packit ae235b
The service automatically stops the GSocketService from accepting
Packit ae235b
new connections when all threads are busy.

Packit ae235b

As with GSocketService, you may connect to “run”,

Packit ae235b
or subclass and override the default handler.

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_threaded_socket_service_new ()

Packit ae235b
GSocketService *
Packit ae235b
g_threaded_socket_service_new (int max_threads);
Packit ae235b

Creates a new GThreadedSocketService with no listeners. Listeners

Packit ae235b
must be added with one of the GSocketListener "add" methods.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

max_threads

Packit ae235b

the maximal number of threads to execute concurrently

Packit ae235b
handling incoming clients, -1 means no limit

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a new GSocketService.

Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b

GThreadedSocketService

Packit ae235b
typedef struct _GThreadedSocketService GThreadedSocketService;
Packit ae235b

A helper class for handling accepting incoming connections in the

Packit ae235b
glib mainloop and handling them in a thread.

Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Property Details

Packit ae235b
Packit ae235b

The “max-threads” property

Packit ae235b
  “max-threads”              gint
Packit ae235b

The max number of threads handling clients for this service.

Packit ae235b

Flags: Read / Write / Construct Only

Packit ae235b

Allowed values: >= -1

Packit ae235b

Default value: 10

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Signal Details

Packit ae235b
Packit ae235b

The “run” signal

Packit ae235b
gboolean
Packit ae235b
user_function (GThreadedSocketService *service,
Packit ae235b
               GSocketConnection      *connection,
Packit ae235b
               GObject                *source_object,
Packit ae235b
               gpointer                user_data)
Packit ae235b

The ::run signal is emitted in a worker thread in response to an

Packit ae235b
incoming connection. This thread is dedicated to handling
Packit ae235b
connection
Packit ae235b
 and may perform blocking IO. The signal handler need
Packit ae235b
not return until the connection is closed.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

service

Packit ae235b

the GThreadedSocketService.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

connection

Packit ae235b

a new GSocketConnection object.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

source_object

Packit ae235b

the source_object passed to g_socket_listener_add_address().

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

user data set when the signal handler was connected.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

TRUE to stop further signal handlers from being called

Packit ae235b
Packit ae235b

Flags: Run Last

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

See Also

Packit ae235b

GSocketService.

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>