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 ()

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_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.

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)

Name

Type

Access

Description

connectable_flags

int

r

current_sync_tic

int

r

delay

float

r

frequency

float

r

gobject

GObject.Object

r

last_run_end

int

r

last_run_start

int

r

max_precision

float

r

my_flags

int

r

obj_mutex

GLib.RecMutex

r

start_cond

GLib.Cond

r

start_mutex

GLib.Mutex

r

start_queue

[object]

r

status_flags

int

r

sync_tic_flags

int

r

thread

GLib.Thread

r

tic_cond

GLib.Cond

r

tic_delay

float

r

tic_mutex

GLib.Mutex

r

uuid

Ags.UUID

r

wait_cond

GLib.Cond

r

wait_mutex

GLib.Mutex

r

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.

New in version 3.0.0.

classmethod new()
Returns:

the new Ags.Thread

Return type:

Ags.Thread

Create a new instance of Ags.Thread.

New in version 3.0.0.

classmethod self()
Returns:

the running Ags.Thread

Return type:

Ags.Thread

Thread self.

New in version 3.0.0.

add_child(child)
Parameters:

child (Ags.Thread) – the child to remove

Add child to thread.

New 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.

New 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.

New 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.

New in version 3.0.0.

children()
Returns:

the children Ags.Thread

Return type:

Ags.Thread

Get children thread.

New in version 3.0.0.

clear_status_flags()

Clear status flags.

New in version 3.0.0.

clear_sync_tic_flags()

Clear sync-tic flags.

New in version 3.0.0.

clock()
Returns:

the cycles to be performed

Return type:

int

Clock the thread.

New 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.

New in version 3.0.0.

first()
Returns:

the very first Ags.Thread within same tree level

Return type:

Ags.Thread

Retrieve first sibling.

New in version 3.0.0.

get_current_sync_tic()
Returns:

the current sync-tic

Return type:

int

Get current sync-tic.

New in version 3.0.0.

get_delay()
Returns:

the delay

Return type:

float

Get delay.

New in version 3.0.0.

get_frequency()
Returns:

the frequency

Return type:

float

Get frequency.

New in version 3.0.0.

get_max_precision()
Returns:

the max-precision

Return type:

float

Get max-precision.

New in version 3.0.0.

get_toplevel()
Returns:

the toplevevel Ags.Thread

Return type:

Ags.Thread

Retrieve toplevel thread.

New 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.

New in version 3.0.0.

lock()

Locks the threads own mutex and sets the appropriate flag.

New in version 3.0.0.

next()
Returns:

the next Ags.Thread

Return type:

Ags.Thread

Get next thread.

New in version 3.0.0.

parent()
Returns:

the parent Ags.Thread

Return type:

Ags.Thread

Get parent thread.

New 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.

New in version 3.0.0.

remove_child(child)
Parameters:

child (Ags.Thread) – the child to remove

Remove child of thread.

New 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.

New 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.

New in version 3.0.0.

set_delay(delay)
Parameters:

delay (float) – the delay

Set delay.

New in version 3.0.0.

set_flags(flags)
Parameters:

flags (Ags.ThreadFlags) – the flags

Set flags.

New in version 3.0.0.

set_frequency(frequency)
Parameters:

frequency (float) – the frequency

Set frequency.

New in version 3.0.0.

set_max_precision(max_precision)
Parameters:

max_precision (float) – the max-precision

Set max-precision.

New in version 3.0.0.

set_status_flags(status_flags)
Parameters:

status_flags (Ags.ThreadStatusFlags) – the status flags

Set status flags.

New 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.

New in version 3.0.0.

set_tree_sync_recursive(current_sync_tic)
Parameters:

current_sync_tic (int) –

start()

Start the thread.

New in version 3.0.0.

stop()

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

New 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.

New 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.

New 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.

New 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.

New in version 3.0.0.

unlock()

Unlocks the threads own mutex and unsets the appropriate flag.

New in version 3.0.0.

unset_flags(flags)
Parameters:

flags (Ags.ThreadFlags) – the flags

Unset flags.

New in version 3.0.0.

unset_status_flags(status_flags)
Parameters:

status_flags (Ags.ThreadStatusFlags) – the status flags

Unset status flags.

New 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.

New in version 3.0.0.

do_clock() virtual
Returns:

the cycles to be performed

Return type:

int

Clock the thread.

New in version 3.0.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.

New in version 3.0.0.

do_start() virtual

Start the thread.

New in version 3.0.0.

do_stop() virtual

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

New 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.

New in version 3.0.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.

New 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.

New 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.

New 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.

New 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.

New 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.

New in version 3.0.0.