Gst.TaskPool

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.TaskPool Gst.TaskPool Gst.Object->Gst.TaskPool

Subclasses:

Gst.SharedTaskPool

Methods

Inherited:

Gst.Object (27), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

cleanup ()

dispose_handle (id)

join (id)

prepare ()

push (func, *user_data)

Virtual Methods

Inherited:

Gst.Object (1), GObject.Object (7)

do_cleanup ()

do_dispose_handle (id)

do_join (id)

do_prepare ()

do_push (func, *user_data)

Properties

Inherited:

Gst.Object (2)

Signals

Inherited:

Gst.Object (1), GObject.Object (1)

Fields

Inherited:

Gst.Object (1), GObject.Object (1)

Name

Type

Access

Description

object

Gst.Object

r

pool

GLib.ThreadPool

r

Class Details

class Gst.TaskPool(**kwargs)
Bases:

Gst.Object

Abstract:

No

Structure:

Gst.TaskPoolClass

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

Subclasses can be made to create custom threads.

classmethod new()[source]
Returns:

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

Return type:

Gst.TaskPool

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

cleanup()[source]

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.

dispose_handle(id)[source]
Parameters:

id (object or None) – the id

Dispose of the handle returned by Gst.TaskPool.push(). This does not need to be called with the default implementation as the default #GstTaskPoolClass::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-None value.

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

New in version 1.20.

join(id)[source]
Parameters:

id (object or None) – the id

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 #GstTaskPoolClass::push implementation always returns None.

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

prepare()[source]
Raises:

GLib.Error

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

MT safe.

push(func, *user_data)[source]
Parameters:
Raises:

GLib.Error

Returns:

a pointer that should be used for the Gst.TaskPool.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.

Return type:

object or None

Start the execution of a new thread from self.

do_cleanup() virtual

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.

do_dispose_handle(id) virtual
Parameters:

id (object or None) – the id

Dispose of the handle returned by Gst.TaskPool.push(). This does not need to be called with the default implementation as the default #GstTaskPoolClass::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-None value.

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

New in version 1.20.

do_join(id) virtual
Parameters:

id (object or None) – the id

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 #GstTaskPoolClass::push implementation always returns None.

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

do_prepare() virtual

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

MT safe.

do_push(func, *user_data) virtual
Parameters:
Returns:

a pointer that should be used for the Gst.TaskPool.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.

Return type:

object or None

Start the execution of a new thread from pool.