Ags.Thread

g Ags.Connectable Ags.Connectable Ags.Thread Ags.Thread Ags.Connectable->Ags.Thread GObject.GInterface GObject.GInterface GObject.GInterface->Ags.Connectable GObject.Object GObject.Object GObject.Object->Ags.Thread

Subclasses:

Ags.GenericMainLoop, Ags.ReturnableThread, Ags.WorkerThread

Methods

Inherited:

GObject.Object (37), Ags.Connectable (13)

Structs:

GObject.ObjectClass (5)

class

global_get_use_sync_counter ()

class

new ()

class

self ()

add_child (child)

add_child_extended (child, no_start, no_wait)

add_start_queue (child)

add_start_queue_all (child)

children ()

clear_status_flags ()

clear_sync_tic_flags ()

clock ()

find_type (gtype)

first ()

get_current_sync_tic ()

get_delay ()

get_frequency ()

get_max_precision ()

get_toplevel ()

is_current_ready (current_sync_tic)

is_tree_ready_recursive (current_sync_tic)

last ()

lock ()

next ()

parent ()

prepare_current_sync (current_sync_tic)

prepare_tree_sync_recursive (current_sync_tic)

prev ()

recover_dead_lock ()

remove_child (child)

run ()

set_current_sync (current_sync_tic)

set_current_sync_tic (current_sync_tic)

set_delay (delay)

set_flags (flags)

set_frequency (frequency)

set_max_precision (max_precision)

set_status_flags (status_flags)

set_sync_tic_flags (sync_tic_flags)

set_tree_sync_recursive (current_sync_tic)

start ()

stop ()

test_flags (flags)

test_status_flags (status_flags)

test_sync_tic_flags (sync_tic_flags)

trylock ()

unlock ()

unset_flags (flags)

unset_status_flags (status_flags)

unset_sync_tic_flags (sync_tic_flags)

Virtual Methods

Inherited:

GObject.Object (7), Ags.Connectable (13)

do_clock ()

do_recover_dead_lock ()

do_run ()

do_start ()

do_stop ()

Properties

Name

Type

Flags

Short Description

delay

float

r/w

The delay until next tic

frequency

float

r/w

frequency as JIFFIE

max-precision

float

r/w

The max precision as JIFFIE

Signals

Inherited:

GObject.Object (1)

Name

Short Description

clock

The ::clock() signal is invoked every thread tic.

recover-dead-lock

The ::recover-dead-lock() signal is invoked as thread needs to recover dead-lock.

run

The ::run() signal is invoked during run loop.

start

The ::start() signal is invoked as thread started.

stop

The ::stop() signal is invoked as thread stopped.

Fields

Inherited:

GObject.Object (1)

Class Details

class Ags.Thread(**kwargs)
Bases:

GObject.Object, Ags.Connectable

Abstract:

No

Structure:

Ags.ThreadClass

classmethod global_get_use_sync_counter()
Returns:

if True use sync counter, else not

Return type:

bool

Get global config value use sync counter.

Added in version 3.0.0.

classmethod new()
Returns:

the new Ags.Thread

Return type:

Ags.Thread

Create a new instance of Ags.Thread.

Added in version 3.0.0.

classmethod self()
Returns:

the running Ags.Thread

Return type:

Ags.Thread

Thread self.

Added in version 3.0.0.

add_child(child)
Parameters:

child (Ags.Thread) – the child to remove

Add child to thread.

Added in version 3.0.0.

add_child_extended(child, no_start, no_wait)
Parameters:
  • child (Ags.Thread) – the child to remove

  • no_start (bool) – don’t start thread

  • no_wait (bool) – don’t wait until started

Add child to thread.

Added in version 3.0.0.

add_start_queue(child)
Parameters:

child (Ags.Thread) – the child Ags.Thread to start

Add child to self's start queue.

Added in version 3.0.0.

add_start_queue_all(child)
Parameters:

child ([Ags.Thread]) – the children as GLib.List-struct containing Ags.Thread to start

Add child to self's start queue.

Added in version 3.0.0.

children()
Returns:

the children Ags.Thread

Return type:

Ags.Thread

Get children thread.

Added in version 3.0.0.

clear_status_flags()

Clear status flags.

Added in version 3.0.0.

clear_sync_tic_flags()

Clear sync-tic flags.

Added in version 3.0.0.

clock()
Returns:

the cycles to be performed

Return type:

int

Clock the thread.

Added in version 3.0.0.

find_type(gtype)
Parameters:

gtype (GObject.GType) – the GObject.GType-struct

Returns:

the matching Ags.Thread

Return type:

Ags.Thread

Find gtype as descendant of self. If its a descendant thread, the ref-count is increased.

Added in version 3.0.0.

first()
Returns:

the very first Ags.Thread within same tree level

Return type:

Ags.Thread

Retrieve first sibling.

Added in version 3.0.0.

get_current_sync_tic()
Returns:

the current sync-tic

Return type:

int

Get current sync-tic.

Added in version 3.0.0.

get_delay()
Returns:

the delay

Return type:

float

Get delay.

Added in version 3.0.0.

get_frequency()
Returns:

the frequency

Return type:

float

Get frequency.

Added in version 3.0.0.

get_max_precision()
Returns:

the max-precision

Return type:

float

Get max-precision.

Added in version 3.0.0.

get_toplevel()
Returns:

the toplevevel Ags.Thread

Return type:

Ags.Thread

Retrieve toplevel thread.

Added in version 3.0.0.

is_current_ready(current_sync_tic)
Parameters:

current_sync_tic (int)

Return type:

bool

is_tree_ready_recursive(current_sync_tic)
Parameters:

current_sync_tic (int)

Return type:

bool

last()
Returns:

the very last AgsThread within same tree level

Return type:

Ags.Thread

Retrieve last sibling.

Added in version 3.0.0.

lock()

Locks the threads own mutex and sets the appropriate flag.

Added in version 3.0.0.

next()
Returns:

the next Ags.Thread

Return type:

Ags.Thread

Get next thread.

Added in version 3.0.0.

parent()
Returns:

the parent Ags.Thread

Return type:

Ags.Thread

Get parent thread.

Added in version 3.0.0.

prepare_current_sync(current_sync_tic)
Parameters:

current_sync_tic (int)

prepare_tree_sync_recursive(current_sync_tic)
Parameters:

current_sync_tic (int)

prev()
Returns:

the prev Ags.Thread

Return type:

Ags.Thread

Get prev thread.

Added in version 3.0.0.

recover_dead_lock()

Recover dead-lock of the thread.

Added in version 7.1.0.

remove_child(child)
Parameters:

child (Ags.Thread) – the child to remove

Remove child of thread.

Added in version 3.0.0.

run()

Only for internal use of ags_thread_loop but you may want to set the your very own class function namely your thread’s routine.

Added in version 3.0.0.

set_current_sync(current_sync_tic)
Parameters:

current_sync_tic (int)

set_current_sync_tic(current_sync_tic)
Parameters:

current_sync_tic (int) – the current sync-tic

Set current sync-tic.

Added in version 3.0.0.

set_delay(delay)
Parameters:

delay (float) – the delay

Set delay.

Added in version 3.0.0.

set_flags(flags)
Parameters:

flags (Ags.ThreadFlags) – the flags

Set flags.

Added in version 3.0.0.

set_frequency(frequency)
Parameters:

frequency (float) – the frequency

Set frequency.

Added in version 3.0.0.

set_max_precision(max_precision)
Parameters:

max_precision (float) – the max-precision

Set max-precision.

Added in version 3.0.0.

set_status_flags(status_flags)
Parameters:

status_flags (Ags.ThreadStatusFlags) – the status flags

Set status flags.

Added in version 3.0.0.

set_sync_tic_flags(sync_tic_flags)
Parameters:

sync_tic_flags (Ags.ThreadSyncTicFlags) – the sync-tic flags

Set sync-tic flags.

Added in version 3.0.0.

set_tree_sync_recursive(current_sync_tic)
Parameters:

current_sync_tic (int)

start()

Start the thread.

Added in version 3.0.0.

stop()

Stop the threads loop by unsetting Ags.ThreadStatusFlags.THREAD_STATUS_RUNNING flag.

Added in version 3.0.0.

test_flags(flags)
Parameters:

flags (Ags.ThreadFlags) – the flags

Returns:

True if flags are set, else False

Return type:

bool

Test flags to be set on self.

Added in version 3.0.0.

test_status_flags(status_flags)
Parameters:

status_flags (Ags.ThreadStatusFlags) – the status flags

Returns:

True if status flags are set, else False

Return type:

bool

Test status_flags to be set on self.

Added in version 3.0.0.

test_sync_tic_flags(sync_tic_flags)
Parameters:

sync_tic_flags (Ags.ThreadSyncTicFlags) – the sync-tic flags

Returns:

True if sync-tic flags are set, else False

Return type:

bool

Test sync_tic_flags to be set on self.

Added in version 3.0.0.

trylock()
Returns:

True on success, otherwise False

Return type:

bool

Locks the threads own mutex if available and sets the appropriate flag and returning True. Otherwise return False without lock.

Added in version 3.0.0.

unlock()

Unlocks the threads own mutex and unsets the appropriate flag.

Added in version 3.0.0.

unset_flags(flags)
Parameters:

flags (Ags.ThreadFlags) – the flags

Unset flags.

Added in version 3.0.0.

unset_status_flags(status_flags)
Parameters:

status_flags (Ags.ThreadStatusFlags) – the status flags

Unset status flags.

Added in version 3.0.0.

unset_sync_tic_flags(sync_tic_flags)
Parameters:

sync_tic_flags (Ags.ThreadSyncTicFlags) – the sync-tic flags

Unset sync-tic flags.

Added in version 3.0.0.

do_clock() virtual
Returns:

the cycles to be performed

Return type:

int

Clock the thread.

Added in version 3.0.0.

do_recover_dead_lock() virtual

Recover dead-lock of the thread.

Added in version 7.1.0.

do_run() virtual

Only for internal use of ags_thread_loop but you may want to set the your very own class function namely your thread’s routine.

Added in version 3.0.0.

do_start() virtual

Start the thread.

Added in version 3.0.0.

do_stop() virtual

Stop the threads loop by unsetting Ags.ThreadStatusFlags.THREAD_STATUS_RUNNING flag.

Added in version 3.0.0.

Signal Details

Ags.Thread.signals.clock(thread)
Signal Name:

clock

Flags:

RUN_LAST

Parameters:

thread (Ags.Thread) – The object which received the signal

Returns:

the number of cycles to perform

Return type:

int

The ::clock() signal is invoked every thread tic.

Added in version 3.0.0.

Ags.Thread.signals.recover_dead_lock(thread)
Signal Name:

recover-dead-lock

Flags:

RUN_LAST

Parameters:

thread (Ags.Thread) – The object which received the signal

The ::recover-dead-lock() signal is invoked as thread needs to recover dead-lock.

Added in version 7.1.0.

Ags.Thread.signals.run(thread)
Signal Name:

run

Flags:

RUN_LAST

Parameters:

thread (Ags.Thread) – The object which received the signal

The ::run() signal is invoked during run loop.

Added in version 3.0.0.

Ags.Thread.signals.start(thread)
Signal Name:

start

Flags:

RUN_LAST

Parameters:

thread (Ags.Thread) – The object which received the signal

The ::start() signal is invoked as thread started.

Added in version 3.0.0.

Ags.Thread.signals.stop(thread)
Signal Name:

stop

Flags:

RUN_LAST

Parameters:

thread (Ags.Thread) – The object which received the signal

The ::stop() signal is invoked as thread stopped.

Added in version 3.0.0.

Property Details

Ags.Thread.props.delay
Name:

delay

Type:

float

Default Value:

1.0

Flags:

READABLE, WRITABLE

The delay until next tic.

Added in version 3.0.0.

Ags.Thread.props.frequency
Name:

frequency

Type:

float

Default Value:

250.0

Flags:

READABLE, WRITABLE

The frequency to run at in Hz.

Added in version 3.0.0.

Ags.Thread.props.max_precision
Name:

max-precision

Type:

float

Default Value:

1000.0

Flags:

READABLE, WRITABLE

The max-frequency to run at in Hz.

Added in version 3.0.0.