Top | ![]() |
![]() |
![]() |
![]() |
Functions
Properties
delay | Read / Write | |
frequency | Read / Write | |
max-precision | Read / Write |
Types and Values
#define | AGS_THREAD_HERTZ_JIFFIE |
#define | AGS_THREAD_YIELD_JIFFIE |
#define | AGS_THREAD_DEFAULT_JIFFIE |
#define | AGS_THREAD_DEFAULT_MAX_PRECISION |
#define | AGS_THREAD_MAX_PRECISION |
#define | AGS_THREAD_DEFAULT_ATTACK |
#define | AGS_THREAD_TOLERANCE |
enum | AgsThreadFlags |
enum | AgsThreadStatusFlags |
enum | AgsThreadSyncTicFlags |
#define | AGS_TYPE_THREAD |
#define | AGS_TYPE_THREAD_FLAGS |
#define | AGS_TYPE_THREAD_STATUS_FLAGS |
#define | AGS_TYPE_THREAD_SYNC_TIC_FLAGS |
struct | AgsThread |
struct | AgsThreadClass |
Object Hierarchy
GFlags ├── AgsThreadFlags ├── AgsThreadStatusFlags ╰── AgsThreadSyncTicFlagsGObject ╰── AgsThread ├── AgsWorkerThread ├── AgsGenericMainLoop ╰── AgsReturnableThread
Description
The AgsThread base class. It supports organizing them within a tree, perform syncing and frequencies.
The thread class synchronizes within tree at max-precision
property
JIFFIE. AgsThread::run()
frequency
property JIFFIE.
The AgsThread::run()
AGS_THREAD_IMMEDIATE_SYNC
flag, sync to the previous or next tic with
AGS_THREAD_INTERMEDIATE_PRE_SYNC
or AGS_THREAD_INTERMEDIATE_POST_SYNC
flag set.
The AgsTread::clock()
max-precision
property
rate per second.
Note you usually have a default source giving you timing hints i.e.
poll is used. If not you can still set the AGS_THREAD_TIME_ACCOUNTING
flags, causing a sleep for every tic.
Further there is no time promise within one second. But you should make sure you hit the real-time dead-line or use a worker thread instead for time expensive work or tasks.
ags_thread_self() returns you your own AgsThread you are running
in or NULL
Functions
AGS_THREAD_GET_OBJ_MUTEX()
#define AGS_THREAD_GET_OBJ_MUTEX(obj) (&(((AgsThread *) obj)->obj_mutex))
AGS_THREAD_GET_WAIT_MUTEX()
#define AGS_THREAD_GET_WAIT_MUTEX(obj) (&(((AgsThread *) obj)->wait_mutex))
AGS_THREAD_GET_WAIT_COND()
#define AGS_THREAD_GET_WAIT_COND(obj) (&(((AgsThread *) obj)->wait_cond))
AGS_THREAD_GET_TIC_MUTEX()
#define AGS_THREAD_GET_TIC_MUTEX(obj) (&(((AgsThread *) obj)->tic_mutex))
AGS_THREAD_GET_START_MUTEX()
#define AGS_THREAD_GET_START_MUTEX(obj) (&(((AgsThread *) obj)->start_mutex))
AGS_THREAD_GET_START_COND()
#define AGS_THREAD_GET_START_COND(obj) (&(((AgsThread *) obj)->start_cond))
ags_thread_global_get_use_sync_counter ()
gboolean ags_thread_global_get_use_sync_counter ();
Get global config value use sync counter.
Since:
ags_thread_test_flags ()
gboolean ags_thread_test_flags (AgsThread *thread
,AgsThreadFlags flags
);
Test flags
to be set on thread
.
Since:
ags_thread_set_flags ()
void ags_thread_set_flags (AgsThread *thread
,AgsThreadFlags flags
);
Set flags.
Since:
ags_thread_unset_flags ()
void ags_thread_unset_flags (AgsThread *thread
,AgsThreadFlags flags
);
Unset flags.
Since:
ags_thread_test_status_flags ()
gboolean ags_thread_test_status_flags (AgsThread *thread
,AgsThreadStatusFlags status_flags
);
Test status_flags
to be set on thread
.
Since:
ags_thread_set_status_flags ()
void ags_thread_set_status_flags (AgsThread *thread
,AgsThreadStatusFlags status_flags
);
Set status flags.
Since:
ags_thread_unset_status_flags ()
void ags_thread_unset_status_flags (AgsThread *thread
,AgsThreadStatusFlags status_flags
);
Unset status flags.
Since:
ags_thread_clear_status_flags ()
void ags_thread_clear_status_flags (AgsThread *thread
);
Clear status flags.
Since:
ags_thread_test_sync_tic_flags ()
gboolean ags_thread_test_sync_tic_flags (AgsThread *thread
,AgsThreadSyncTicFlags sync_tic_flags
);
Test sync_tic_flags
to be set on thread
.
Since:
ags_thread_set_sync_tic_flags ()
void ags_thread_set_sync_tic_flags (AgsThread *thread
,AgsThreadSyncTicFlags sync_tic_flags
);
Set sync-tic flags.
Since:
ags_thread_unset_sync_tic_flags ()
void ags_thread_unset_sync_tic_flags (AgsThread *thread
,AgsThreadSyncTicFlags sync_tic_flags
);
Unset sync-tic flags.
Since:
ags_thread_clear_sync_tic_flags ()
void ags_thread_clear_sync_tic_flags (AgsThread *thread
);
Clear sync-tic flags.
Since:
ags_thread_set_current_sync_tic ()
void ags_thread_set_current_sync_tic (AgsThread *thread
,);
guint current_sync_tic
Set current sync-tic.
Since:
ags_thread_get_current_sync_tic ()
guint ags_thread_get_current_sync_tic (AgsThread *thread
);
Get current sync-tic.
Since:
ags_thread_set_delay ()
void ags_thread_set_delay (AgsThread *thread
,);
gdouble delay
Set delay.
Since:
ags_thread_set_frequency ()
void ags_thread_set_frequency (AgsThread *thread
,);
gdouble frequency
Set frequency.
Since:
ags_thread_get_frequency ()
gdouble ags_thread_get_frequency (AgsThread *thread
);
Get frequency.
Since:
ags_thread_set_max_precision ()
void ags_thread_set_max_precision (AgsThread *thread
,);
gdouble max_precision
Set max-precision.
Since:
ags_thread_get_max_precision ()
gdouble ags_thread_get_max_precision (AgsThread *thread
);
Get max-precision.
Since:
ags_thread_find_type ()
AgsThread * ags_thread_find_type (AgsThread *thread
,);
GType gtype
Find gtype
as descendant of thread
. If its a descendant thread,
the ref-count is increased.
Since:
ags_thread_parent ()
AgsThread *
ags_thread_parent (AgsThread *thread
);
Get parent thread.
Since:
ags_thread_children ()
AgsThread *
ags_thread_children (AgsThread *thread
);
Get children thread.
Since:
ags_thread_get_toplevel ()
AgsThread *
ags_thread_get_toplevel (AgsThread *thread
);
Retrieve toplevel thread.
Since:
ags_thread_first ()
AgsThread *
ags_thread_first (AgsThread *thread
);
Retrieve first sibling.
Since:
ags_thread_last ()
AgsThread *
ags_thread_last (AgsThread *thread
);
Retrieve last sibling.
Since:
ags_thread_lock ()
void ags_thread_lock (AgsThread *thread
);
Locks the threads own mutex and sets the appropriate flag.
Since:
ags_thread_trylock ()
gboolean ags_thread_trylock (AgsThread *thread
);
Locks the threads own mutex if available and sets the
appropriate flag and returning TRUE
FALSE
Since:
ags_thread_unlock ()
void ags_thread_unlock (AgsThread *thread
);
Unlocks the threads own mutex and unsets the appropriate flag.
Since:
ags_thread_remove_child ()
void ags_thread_remove_child (AgsThread *thread
,AgsThread *child
);
Remove child of thread.
Since:
ags_thread_add_child ()
void ags_thread_add_child (AgsThread *thread
,AgsThread *child
);
Add child to thread.
Since:
ags_thread_add_child_extended ()
void ags_thread_add_child_extended (AgsThread *thread
,AgsThread *child
,,
gboolean no_start);
gboolean no_wait
Add child to thread.
Parameters
thread |
the AgsThread |
|
child |
the child to remove |
|
no_start |
don't start thread |
|
no_wait |
don't wait until started |
Since:
ags_thread_is_current_ready ()
gboolean ags_thread_is_current_ready (AgsThread *current
,);
guint current_sync_tic
ags_thread_is_tree_ready_recursive ()
gboolean ags_thread_is_tree_ready_recursive (AgsThread *thread
,);
guint current_sync_tic
ags_thread_prepare_current_sync ()
void ags_thread_prepare_current_sync (AgsThread *current
,);
guint current_sync_tic
ags_thread_prepare_tree_sync_recursive ()
void ags_thread_prepare_tree_sync_recursive (AgsThread *thread
,);
guint current_sync_tic
ags_thread_set_current_sync ()
void ags_thread_set_current_sync (AgsThread *current
,);
guint current_sync_tic
ags_thread_set_tree_sync_recursive ()
void ags_thread_set_tree_sync_recursive (AgsThread *thread
,);
guint current_sync_tic
ags_thread_add_start_queue ()
void ags_thread_add_start_queue (AgsThread *thread
,AgsThread *child
);
Add child
to thread
's start queue.
Since:
ags_thread_add_start_queue_all ()
void ags_thread_add_start_queue_all (AgsThread *thread
,);
GList *child
Add child
to thread
's start queue.
Since:
ags_thread_run ()
void ags_thread_run (AgsThread *thread
);
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.
Since:
ags_thread_stop ()
void ags_thread_stop (AgsThread *thread
);
Stop the threads loop by unsetting AGS_THREAD_STATUS_RUNNING flag.
Since:
AGS_IS_THREAD_CLASS()
#define AGS_IS_THREAD_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), AGS_TYPE_THREAD))
AGS_THREAD()
#define AGS_THREAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_THREAD, AgsThread))
AGS_THREAD_CLASS()
#define AGS_THREAD_CLASS(class) (G_TYPE_CHECK_CLASS_CAST(class, AGS_TYPE_THREAD, AgsThreadClass))
AGS_THREAD_GET_CLASS()
#define AGS_THREAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS(obj, AGS_TYPE_THREAD, AgsThreadClass))
Types and Values
enum AgsThreadFlags
Enum values to control the behavior or indicate internal state of AgsThread by enable/disable as flags.
enum AgsThreadStatusFlags
Enum values to control the behavior or indicate internal state of AgsThread by enable/disable as status flags.
Members
realtime setup was performed |
||
initial sync indicates the thread wasn't synced before |
||
the first call to |
||
the thread is not synced |
||
the thread start is waiting |
||
the thread start is done |
||
the thread is ready |
||
the thread is waiting |
||
the thread is running |
||
the thread is locked |
||
the thread is busy |
||
the thread joined the tic based system, it is synced |
||
the frequency was synced |
enum AgsThreadSyncTicFlags
Enum values to control the behavior or indicate internal state of AgsThread by enable/disable as sync tic flags.
Members
wait tree to be synced |
||
done tree to be synced |
||
wait tree to be synced |
||
done tree to be synced |
||
wait tree to be synced |
||
done tree to be synced |
||
wait tree to be synced |
||
done tree to be synced |
||
wait tree to be synced |
||
done tree to be synced |
||
wait tree to be synced |
||
done tree to be synced |
||
wait tree to be synced |
||
done tree to be synced |
||
wait tree to be synced |
||
done tree to be synced |
||
wait tree to be synced |
||
done tree to be synced |
AGS_TYPE_THREAD_STATUS_FLAGS
#define AGS_TYPE_THREAD_STATUS_FLAGS (ags_thread_status_flags_get_type())
AGS_TYPE_THREAD_SYNC_TIC_FLAGS
#define AGS_TYPE_THREAD_SYNC_TIC_FLAGS (ags_thread_sync_tic_flags_get_type())
Property Details
The “delay”
property
“delay”double
The delay until next tic.
Owner: AgsThread
Flags: Read / Write
Allowed values: [1,1000]
Default value: 1
Since:
The “frequency”
property
“frequency”double
The frequency to run at in Hz.
Owner: AgsThread
Flags: Read / Write
Allowed values: [0.01,1000]
Default value: 250
Since:
Signal Details
The “clock”
signal
guint user_function (AgsThread *thread,gpointer user_data)
The ::clock()
Flags:
Since:
The “run”
signal
void user_function (AgsThread *thread,gpointer user_data)
The ::run()
Flags:
Since:
The “start”
signal
void user_function (AgsThread *thread,gpointer user_data)
The ::start()
Flags:
Since: