krähemann.com

AgsThreadPool

AgsThreadPool — thread pool

Stability Level

Stable, unless otherwise indicated

Properties

guint max-threads Read / Write
guint max-unused-threads Read / Write

Signals

void start Run Last

Object Hierarchy

    GFlags
    ╰── AgsThreadPoolFlags
    GObject
    ╰── AgsThreadPool

Includes

#include <ags/thread/ags_thread_pool.h>

Description

The AgsThreadPool acts as preinstantiated threads store. This can achieve enormeous performance.

Functions

ags_thread_pool_pull ()

AgsThread *
ags_thread_pool_pull (AgsThreadPool *thread_pool);

Pull a previously instantiated AgsReturnableThread. Note this function may block until a new thread is available.

Parameters

thread_pool

the AgsThreadPool

 

Returns

a new AgsThread.

[transfer full]

Since: 3.0.0


ags_thread_pool_start ()

void
ags_thread_pool_start (AgsThreadPool *thread_pool);

Start the thread pool.

Parameters

thread_pool

the AgsThreadPool

 

Since: 3.0.0


ags_thread_pool_new ()

AgsThreadPool *
ags_thread_pool_new (AgsThread *parent);

Create a new AgsThreadPool.

Parameters

parent

the parent AgsThread of returnable threads

 

Returns

the new AgsThreadPool

Since: 3.0.0

Types and Values

AGS_THREAD_POOL_DEFAULT_MAX_UNUSED_THREADS

#define AGS_THREAD_POOL_DEFAULT_MAX_UNUSED_THREADS (8)

AGS_THREAD_POOL_DEFAULT_MAX_THREADS

#define AGS_THREAD_POOL_DEFAULT_MAX_THREADS (1024)

enum AgsThreadPoolFlags

Enum values to control the behavior or indicate internal state of AgsThreadPool by enable/disable as sync_flags.

Members

AGS_THREAD_POOL_RUNNING

the thread pool is running

 

AGS_THREAD_POOL_RT_SETUP

realtime setup has been performed

 

Property Details

The “max-threads” property

  “max-threads”              guint

The maximum amount of threads available.

Owner: AgsThreadPool

Flags: Read / Write

Allowed values: [1,65535]

Default value: 1024

Since: 3.0.0


The “max-unused-threads” property

  “max-unused-threads”       guint

The maximum amount of unused threads available.

Owner: AgsThreadPool

Flags: Read / Write

Allowed values: [1,65535]

Default value: 8

Since: 3.0.0

Signal Details

The “start” signal

void
user_function (AgsThreadPool *thread_pool,
               gpointer       user_data)

The ::start() signal is invoked in order to started the pool.

Parameters

thread_pool

the AgsThreadPool

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.0.0