# GstTaskPool

This object provides an abstraction for creating threads. The default implementation uses a regular GThreadPool to start tasks.

Subclasses can be made to create custom threads.

## GstSharedTaskPool

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstTaskPool
                    ╰──GstSharedTaskPool

The GstSharedTaskPool object.

### Members

`parent` (GstTaskPool) –
No description available

since : 1.20

### Class structure

#### GstSharedTaskPoolClass

The GstSharedTaskPoolClass object.

##### Fields

`parent_class` (GstTaskPoolClass) –
No description available

Since : 1.20

### Gst.SharedTaskPoolClass

The Gst.SharedTaskPoolClass object.

##### Attributes

`parent_class` (Gst.TaskPoolClass) –
No description available

Since : 1.20

### Gst.SharedTaskPoolClass

The Gst.SharedTaskPoolClass object.

##### Attributes

`parent_class` (Gst.TaskPoolClass) –
No description available

Since : 1.20

## Gst.SharedTaskPool

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.TaskPool
                    ╰──Gst.SharedTaskPool

The Gst.SharedTaskPool object.

### Members

`parent` (Gst.TaskPool) –
No description available

since : 1.20

## Gst.SharedTaskPool

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.TaskPool
                    ╰──Gst.SharedTaskPool

The Gst.SharedTaskPool object.

### Members

`parent` (Gst.TaskPool) –
No description available

since : 1.20

### Constructors

#### gst_shared_task_pool_new

    GstTaskPool *
    gst_shared_task_pool_new ()

Create a new shared task pool. The shared task pool will queue tasks on a maximum number of threads, 1 by default.

Do not use a GstSharedTaskPool to manage potentially inter-dependent tasks such as pad tasks, as having one task waiting on another to return before returning would cause obvious deadlocks if they happen to share the same thread.

Returns ( [transfer: full]) –

a new GstSharedTaskPool. gst_object_unref after usage.

Since : 1.20

#### Gst.SharedTaskPool.prototype.new

    function Gst.SharedTaskPool.prototype.new(): {
        // javascript wrapper for 'gst_shared_task_pool_new'
    }

Create a new shared task pool. The shared task pool will queue tasks on a maximum number of threads, 1 by default.

Do not use a Gst.SharedTaskPool to manage potentially inter-dependent tasks such as pad tasks, as having one task waiting on another to return before returning would cause obvious deadlocks if they happen to share the same thread.

Returns (Gst.TaskPool) –

a new Gst.SharedTaskPool. Gst.Object.prototype.unref after usage.

Since : 1.20

#### Gst.SharedTaskPool.new

    def Gst.SharedTaskPool.new ():
        #python wrapper for 'gst_shared_task_pool_new'

Create a new shared task pool. The shared task pool will queue tasks on a maximum number of threads, 1 by default.

Do not use a Gst.SharedTaskPool to manage potentially inter-dependent tasks such as pad tasks, as having one task waiting on another to return before returning would cause obvious deadlocks if they happen to share the same thread.

Returns (Gst.TaskPool) –

a new Gst.SharedTaskPool. Gst.Object.unref after usage.

Since : 1.20

### Methods

#### gst_shared_task_pool_get_max_threads

    guint
    gst_shared_task_pool_get_max_threads (GstSharedTaskPool * pool)

Parameters:

`pool` –

a GstSharedTaskPool

Returns –

the maximum number of threads pool is configured to spawn

Since : 1.20

#### Gst.SharedTaskPool.prototype.get_max_threads

    function Gst.SharedTaskPool.prototype.get_max_threads(): {
        // javascript wrapper for 'gst_shared_task_pool_get_max_threads'
    }

Parameters:

`pool` (Gst.SharedTaskPool) –

a Gst.SharedTaskPool

Returns (Number) –

the maximum number of threads pool is configured to spawn

Since : 1.20

#### Gst.SharedTaskPool.get_max_threads

    def Gst.SharedTaskPool.get_max_threads (self):
        #python wrapper for 'gst_shared_task_pool_get_max_threads'

Parameters:

`pool` (Gst.SharedTaskPool) –

a Gst.SharedTaskPool

Returns (int) –

the maximum number of threads pool is configured to spawn

Since : 1.20

#### gst_shared_task_pool_set_max_threads

    gst_shared_task_pool_set_max_threads (GstSharedTaskPool * pool,
                                          guint max_threads)

Update the maximal number of threads the pool may spawn. When the maximal number of threads is reduced, existing threads are not immediately shut down, see g_thread_pool_set_max_threads.

Setting max_threads to 0 effectively freezes the pool.

Parameters:

`pool` –

a GstSharedTaskPool

`max_threads` –

Maximum number of threads to spawn.

Since : 1.20

#### Gst.SharedTaskPool.prototype.set_max_threads

    function Gst.SharedTaskPool.prototype.set_max_threads(max_threads: Number): {
        // javascript wrapper for 'gst_shared_task_pool_set_max_threads'
    }

Update the maximal number of threads the pool may spawn. When the maximal number of threads is reduced, existing threads are not immediately shut down, see GLib.ThreadPool.prototype.set_max_threads.

Setting max_threads to 0 effectively freezes the pool.

Parameters:

`pool` (Gst.SharedTaskPool) –

a Gst.SharedTaskPool

`max_threads` (Number) –

Maximum number of threads to spawn.

Since : 1.20

#### Gst.SharedTaskPool.set_max_threads

    def Gst.SharedTaskPool.set_max_threads (self, max_threads):
        #python wrapper for 'gst_shared_task_pool_set_max_threads'

Update the maximal number of threads the pool may spawn. When the maximal number of threads is reduced, existing threads are not immediately shut down, see GLib.ThreadPool.set_max_threads.

Setting max_threads to 0 effectively freezes the pool.

Parameters:

`pool` (Gst.SharedTaskPool) –

a Gst.SharedTaskPool

`max_threads` (int) –

Maximum number of threads to spawn.

Since : 1.20

## GstTaskPool

    GObject
        ╰──GInitiallyUnowned
            ╰──GstObject
                ╰──GstTaskPool
                    ╰──GstSharedTaskPool

The GstTaskPool object.

### Members

`object` (GstObject) –
No description available

### Class structure

#### GstTaskPoolClass

The GstTaskPoolClass object.

##### Fields

`parent_class` (GstObjectClass) –

the parent class structure

### Gst.TaskPoolClass

The Gst.TaskPoolClass object.

##### Attributes

`parent_class` (Gst.ObjectClass) –

the parent class structure

### Gst.TaskPoolClass

The Gst.TaskPoolClass object.

##### Attributes

`parent_class` (Gst.ObjectClass) –

the parent class structure

## Gst.TaskPool

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.TaskPool
                    ╰──Gst.SharedTaskPool

The Gst.TaskPool object.

### Members

`object` (Gst.Object) –
No description available

## Gst.TaskPool

    GObject.Object
        ╰──GObject.InitiallyUnowned
            ╰──Gst.Object
                ╰──Gst.TaskPool
                    ╰──Gst.SharedTaskPool

The Gst.TaskPool object.

### Members

`object` (Gst.Object) –
No description available

### Constructors

#### gst_task_pool_new

    GstTaskPool *
    gst_task_pool_new ()

Create a new default task pool. The default task pool will use a regular GThreadPool for threads.

Returns ( [transfer: full]) –

a new GstTaskPool. gst_object_unref after usage.

#### Gst.TaskPool.prototype.new

    function Gst.TaskPool.prototype.new(): {
        // javascript wrapper for 'gst_task_pool_new'
    }

Create a new default task pool. The default task pool will use a regular GThreadPool for threads.

Returns (Gst.TaskPool) –

a new Gst.TaskPool. Gst.Object.prototype.unref after usage.

#### Gst.TaskPool.new

    def Gst.TaskPool.new ():
        #python wrapper for 'gst_task_pool_new'

Create a new default task pool. The default task pool will use a regular GThreadPool for threads.

Returns (Gst.TaskPool) –

a new Gst.TaskPool. Gst.Object.unref after usage.

### Methods

#### gst_task_pool_cleanup

    gst_task_pool_cleanup (GstTaskPool * pool)

Wait for all tasks to be stopped. This is mainly used internally to ensure proper cleanup of internal data structures in test suites.

MT safe.

Parameters:

`pool` –

a GstTaskPool

#### Gst.TaskPool.prototype.cleanup

    function Gst.TaskPool.prototype.cleanup(): {
        // javascript wrapper for 'gst_task_pool_cleanup'
    }

Wait for all tasks to be stopped. This is mainly used internally to ensure proper cleanup of internal data structures in test suites.

MT safe.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

#### Gst.TaskPool.cleanup

    def Gst.TaskPool.cleanup (self):
        #python wrapper for 'gst_task_pool_cleanup'

Wait for all tasks to be stopped. This is mainly used internally to ensure proper cleanup of internal data structures in test suites.

MT safe.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

#### gst_task_pool_dispose_handle

    gst_task_pool_dispose_handle (GstTaskPool * pool,
                                  gpointer id)

Dispose of the handle returned by gst_task_pool_push. This does not need to be called with the default implementation as the default push implementation always returns NULL. This does not need to be called either when calling gst_task_pool_join, but should be called when joining is not necessary, but gst_task_pool_push returned a non-%NULL value.

This method should only be called with the same pool instance that provided id.

Parameters:

`pool` –

a GstTaskPool

`id` ( [transfer: full][nullable]) –

the id

Since : 1.20

#### Gst.TaskPool.prototype.dispose_handle

    function Gst.TaskPool.prototype.dispose_handle(id: Object): {
        // javascript wrapper for 'gst_task_pool_dispose_handle'
    }

Dispose of the handle returned by Gst.TaskPool.prototype.push. This does not need to be called with the default implementation as the default vfunc_push implementation always returns null. This does not need to be called either when calling Gst.TaskPool.prototype.join, but should be called when joining is not necessary, but Gst.TaskPool.prototype.push returned a non-%NULL value.

This method should only be called with the same pool instance that provided id.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

`id` (Object) –

the id

Since : 1.20

#### Gst.TaskPool.dispose_handle

    def Gst.TaskPool.dispose_handle (self, id):
        #python wrapper for 'gst_task_pool_dispose_handle'

Dispose of the handle returned by Gst.TaskPool.push. This does not need to be called with the default implementation as the default do_push implementation always returns None. This does not need to be called either when calling Gst.TaskPool.join, but should be called when joining is not necessary, but Gst.TaskPool.push returned a non-%NULL value.

This method should only be called with the same pool instance that provided id.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

`id` (object) –

the id

Since : 1.20

#### gst_task_pool_join

    gst_task_pool_join (GstTaskPool * pool,
                        gpointer id)

Join a task and/or return it to the pool. id is the id obtained from gst_task_pool_push. The default implementation does nothing, as the default push implementation always returns NULL.

This method should only be called with the same pool instance that provided id.

Parameters:

`pool` –

a GstTaskPool

`id` ( [transfer: full][nullable]) –

the id

#### Gst.TaskPool.prototype.join

    function Gst.TaskPool.prototype.join(id: Object): {
        // javascript wrapper for 'gst_task_pool_join'
    }

Join a task and/or return it to the pool. id is the id obtained from Gst.TaskPool.prototype.push. The default implementation does nothing, as the default vfunc_push implementation always returns null.

This method should only be called with the same pool instance that provided id.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

`id` (Object) –

the id

#### Gst.TaskPool.join

    def Gst.TaskPool.join (self, id):
        #python wrapper for 'gst_task_pool_join'

Join a task and/or return it to the pool. id is the id obtained from Gst.TaskPool.push. The default implementation does nothing, as the default do_push implementation always returns None.

This method should only be called with the same pool instance that provided id.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

`id` (object) –

the id

#### gst_task_pool_prepare

    gst_task_pool_prepare (GstTaskPool * pool,
                           GError ** error)

Prepare the taskpool for accepting gst_task_pool_push operations.

MT safe.

Parameters:

`pool` –

a GstTaskPool

`error` –

an error return location

#### Gst.TaskPool.prototype.prepare

    function Gst.TaskPool.prototype.prepare(): {
        // javascript wrapper for 'gst_task_pool_prepare'
    }

Prepare the taskpool for accepting Gst.TaskPool.prototype.push operations.

MT safe.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

#### Gst.TaskPool.prepare

    @raises(GLib.GError)
    def Gst.TaskPool.prepare (self):
        #python wrapper for 'gst_task_pool_prepare'

Prepare the taskpool for accepting Gst.TaskPool.push operations.

MT safe.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

#### gst_task_pool_push

    gpointer
    gst_task_pool_push (GstTaskPool * pool,
                        GstTaskPoolFunction func,
                        gpointer user_data,
                        GError ** error)

Start the execution of a new thread from pool.

Parameters:

`pool` –

a GstTaskPool

`func` ( [scope async][closure]) –

the function to call

`user_data` –

data to pass to func

`error` –

return location for an error

Returns ( [transfer: full][nullable]) –

a pointer that should be used for the gst_task_pool_join function. This pointer can be NULL, you must check error to detect errors. If the pointer is not NULL and gst_task_pool_join is not used, call gst_task_pool_dispose_handle instead.

#### Gst.TaskPool.prototype.push

    function Gst.TaskPool.prototype.push(func: Gst.TaskPoolFunction, user_data: Object): {
        // javascript wrapper for 'gst_task_pool_push'
    }

Start the execution of a new thread from pool.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

`func` (Gst.TaskPoolFunction) –

the function to call

`user_data` (Object) –

data to pass to func

Returns (Object) –

a pointer that should be used for the gst_task_pool_join function. This pointer can be null, you must check error to detect errors. If the pointer is not null and Gst.TaskPool.prototype.join is not used, call Gst.TaskPool.prototype.dispose_handle instead.

#### Gst.TaskPool.push

    @raises(GLib.GError)
    def Gst.TaskPool.push (self, func, *user_data):
        #python wrapper for 'gst_task_pool_push'

Start the execution of a new thread from pool.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

`func` (Gst.TaskPoolFunction) –

the function to call

`user_data` (variadic) –

data to pass to func

Returns (object) –

a pointer that should be used for the gst_task_pool_join function. This pointer can be None, you must check error to detect errors. If the pointer is not None and Gst.TaskPool.join is not used, call Gst.TaskPool.dispose_handle instead.

### Virtual Methods

#### cleanup

    cleanup (GstTaskPool * pool)

make sure all threads are stopped

Parameters:

`pool` –
No description available

#### vfunc_cleanup

    function vfunc_cleanup(pool: Gst.TaskPool): {
        // javascript implementation of the 'cleanup' virtual method
    }

make sure all threads are stopped

Parameters:

`pool` (Gst.TaskPool) –
No description available

#### do_cleanup

    def do_cleanup (pool):
        #python implementation of the 'cleanup' virtual method

make sure all threads are stopped

Parameters:

`pool` (Gst.TaskPool) –
No description available

#### dispose_handle

    dispose_handle (GstTaskPool * pool,
                    gpointer id)

free / unref the handle returned in GstTaskPoolClass::push.

Parameters:

`pool` –

a GstTaskPool

`id` ( [transfer: full]) –

the handle to dispose of

Since : 1.20

#### vfunc_dispose_handle

    function vfunc_dispose_handle(pool: Gst.TaskPool, id: Object): {
        // javascript implementation of the 'dispose_handle' virtual method
    }

free / unref the handle returned in GstTaskPoolClass::push.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

`id` (Object) –

the handle to dispose of

Since : 1.20

#### do_dispose_handle

    def do_dispose_handle (pool, id):
        #python implementation of the 'dispose_handle' virtual method

free / unref the handle returned in GstTaskPoolClass::push.

Parameters:

`pool` (Gst.TaskPool) –

a Gst.TaskPool

`id` (object) –

the handle to dispose of

Since : 1.20

#### join

    join (GstTaskPool * pool,
          gpointer id)

join a thread

Parameters:

`pool` –
No description available
`id` –
No description available

#### vfunc_join

    function vfunc_join(pool: Gst.TaskPool, id: Object): {
        // javascript implementation of the 'join' virtual method
    }

join a thread

Parameters:

`pool` (Gst.TaskPool) –
No description available
`id` (Object) –
No description available

#### do_join

    def do_join (pool, id):
        #python implementation of the 'join' virtual method

join a thread

Parameters:

`pool` (Gst.TaskPool) –
No description available
`id` (object) –
No description available

#### prepare

    prepare (GstTaskPool * pool,
             GError ** error)

prepare the threadpool

Parameters:

`pool` –
No description available
`error` –
No description available

#### vfunc_prepare

    function vfunc_prepare(pool: Gst.TaskPool): {
        // javascript implementation of the 'prepare' virtual method
    }

prepare the threadpool

Parameters:

`pool` (Gst.TaskPool) –
No description available

#### do_prepare

    def do_prepare (pool):
        #python implementation of the 'prepare' virtual method

prepare the threadpool

Parameters:

`pool` (Gst.TaskPool) –
No description available

#### push

    gpointer
    push (GstTaskPool * pool,
          GstTaskPoolFunction func,
          gpointer user_data,
          GError ** error)

start a new thread

Parameters:

`pool` –
No description available
`func` –
No description available
`user_data` –
No description available
`error` –
No description available
Returns –
No description available

#### vfunc_push

    function vfunc_push(pool: Gst.TaskPool, func: Gst.TaskPoolFunction, user_data: Object): {
        // javascript implementation of the 'push' virtual method
    }

start a new thread

Parameters:

`pool` (Gst.TaskPool) –
No description available
`func` (Gst.TaskPoolFunction) –
No description available
`user_data` (Object) –
No description available
Returns (Object) –
No description available

#### do_push

    def do_push (pool, func, *user_data):
        #python implementation of the 'push' virtual method

start a new thread

Parameters:

`pool` (Gst.TaskPool) –
No description available
`func` (Gst.TaskPoolFunction) –
No description available
`user_data` (variadic) –
No description available
Returns (object) –
No description available

## Function Macros

### GST_TASK_POOL_CAST

    #define GST_TASK_POOL_CAST(pool)       ((GstTaskPool*)(pool))

## Constants

### GST_TASK_POOL_CONTEXT_TYPE

    #define GST_TASK_POOL_CONTEXT_TYPE "gst.task.pool"

The well-known context type for sharing a GstTaskPool between elements in a pipeline.

Elements that support this context will post a GST_MESSAGE_NEED_CONTEXT message on the bus when they need a task pool. Applications can respond by setting the context on the element or the pipeline. Elements will not query neighbors for this context type as the task pool is optional and elements will fall back to their default behavior if no pool is provided.

Since : 1.28

### Gst.TASK_POOL_CONTEXT_TYPE

The well-known context type for sharing a Gst.TaskPool between elements in a pipeline.

Elements that support this context will post a Gst.MessageType.NEED_CONTEXT message on the bus when they need a task pool. Applications can respond by setting the context on the element or the pipeline. Elements will not query neighbors for this context type as the task pool is optional and elements will fall back to their default behavior if no pool is provided.

Since : 1.28

### Gst.TASK_POOL_CONTEXT_TYPE

The well-known context type for sharing a Gst.TaskPool between elements in a pipeline.

Elements that support this context will post a Gst.MessageType.NEED_CONTEXT message on the bus when they need a task pool. Applications can respond by setting the context on the element or the pipeline. Elements will not query neighbors for this context type as the task pool is optional and elements will fall back to their default behavior if no pool is provided.

Since : 1.28

## Callbacks

### GstTaskPoolFunction

    (*GstTaskPoolFunction) (void* user_data)

Task function, see gst_task_pool_push.

Parameters:

`user_data` –

user data for the task function

### Gst.TaskPoolFunction

    function Gst.TaskPoolFunction(user_data: Object): {
        // javascript wrapper for 'GstTaskPoolFunction'
    }

Task function, see Gst.TaskPool.prototype.push.

Parameters:

`user_data` (Object) –

user data for the task function

### Gst.TaskPoolFunction

    def Gst.TaskPoolFunction (*user_data):
        #python wrapper for 'GstTaskPoolFunction'

Task function, see Gst.TaskPool.push.

Parameters:

`user_data` (variadic) –

user data for the task function

The results of the search are