| Top |
| #define | AGS_THREAD_RESUME_SIG |
| #define | AGS_THREAD_SUSPEND_SIG |
| #define | AGS_RT_PRIORITY |
| #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 | AgsThreadSyncFlags |
| #define | AGS_TYPE_THREAD |
| struct | AgsThread |
| struct | AgsThreadClass |
GObject
╰── AgsThread
├── AgsAutosaveThread
├── AgsWorkerThread
├── AgsGenericMainLoop
├── AgsPollingThread
├── AgsTaskThread
├── AgsReturnableThread
╰── AgsSingleThread
The AgsThread base class. It supports organizing them within a tree, perform syncing and frequencies.
pthread_mutex_t *
ags_thread_get_class_mutex ();
Use this function's returned mutex to access mutex fields.
Since: 2.0.0
gboolean ags_thread_test_flags (AgsThread *thread,guint flags);
Test flags
to be set on thread
.
Since: 2.0.0
void ags_thread_set_flags (AgsThread *thread,guint flags);
Set flags.
Since: 2.0.0
void ags_thread_unset_flags (AgsThread *thread,guint flags);
Unset flags.
Since: 2.0.0
gboolean ags_thread_test_sync_flags (AgsThread *thread,guint flags);
Test sync_flags
to be set on thread
.
Since: 2.0.0
void ags_thread_set_sync_flags (AgsThread *thread,guint flags);
Set sync flags.
Since: 2.0.0
void ags_thread_unset_sync_flags (AgsThread *thread,guint flags);
Unset sync flags.
Since: 2.0.0
void ags_thread_set_sync (AgsThread *thread,guint tic);
Unsets AGS_THREAD_WAIT_0, AGS_THREAD_WAIT_1 or AGS_THREAD_WAIT_2. Additionaly the thread is woken up by this function if waiting.
Since: 2.0.0
void ags_thread_set_sync_all (AgsThread *thread,guint tic);
Calls ags_thread_set_sync() on all threads.
Since: 2.0.0
void
ags_thread_reset_all (AgsThread *thread);
Reset all threads. E.g. suspended threads. A synchronization stage after AgsAsyncQueue run.
Since: 2.0.0
void
ags_thread_lock (AgsThread *thread);
Locks the threads own mutex and sets the appropriate flag.
Since: 2.0.0
gboolean
ags_thread_trylock (AgsThread *thread);
Locks the threads own mutex if available and sets the
appropriate flag and returning TRUE. Otherwise return FALSE
without lock.
Since: 2.0.0
void
ags_thread_unlock (AgsThread *thread);
Unlocks the threads own mutex and unsets the appropriate flag.
Since: 2.0.0
AgsThread *
ags_thread_get_toplevel (AgsThread *thread);
Retrieve toplevel thread.
Since: 2.0.0
AgsThread *
ags_thread_first (AgsThread *thread);
Retrieve first sibling.
Since: 2.0.0
AgsThread *
ags_thread_last (AgsThread *thread);
Retrieve last sibling.
Since: 2.0.0
void ags_thread_remove_child (AgsThread *thread,AgsThread *child);
Remove child of thread.
Since: 2.0.0
void ags_thread_add_child (AgsThread *thread,AgsThread *child);
Add child to thread.
Since: 2.0.0
void ags_thread_add_child_extended (AgsThread *thread,AgsThread *child,gboolean no_start,gboolean no_wait);
Add child to thread.
thread |
an AgsThread |
|
child |
the child to remove |
|
no_start |
don't start thread |
|
no_wait |
don't wait until started |
Since: 2.0.0
gboolean ags_thread_parental_is_locked (AgsThread *thread,AgsThread *parent);
Check the AGS_THREAD_LOCKED flag in parental levels.
Since: 2.0.0
gboolean
ags_thread_sibling_is_locked (AgsThread *thread);
Check the AGS_THREAD_LOCKED flag within sibling.
Since: 2.0.0
gboolean
ags_thread_children_is_locked (AgsThread *thread);
Check the AGS_THREAD_LOCKED flag within children.
Since: 2.0.0
gboolean ags_thread_is_current_ready (AgsThread *current,guint tic);
AgsThread * ags_thread_next_parent_locked (AgsThread *thread,AgsThread *parent);
Retrieve next locked thread above thread
.
Since: 2.0.0
AgsThread *
ags_thread_next_sibling_locked (AgsThread *thread);
Retrieve next locked thread neighbooring thread
Since: 2.0.0
AgsThread *
ags_thread_next_children_locked (AgsThread *thread);
Retrieve next locked thread following thread
Since: 2.0.0
void ags_thread_lock_parent (AgsThread *thread,AgsThread *parent);
Lock parent tree structure.
Since: 2.0.0
void
ags_thread_lock_sibling (AgsThread *thread);
Lock sibling tree structure.
Since: 2.0.0
void
ags_thread_lock_children (AgsThread *thread);
Lock child tree structure.
Since: 2.0.0
void ags_thread_unlock_parent (AgsThread *thread,AgsThread *parent);
Unlock parent tree structure.
Since: 2.0.0
void
ags_thread_unlock_sibling (AgsThread *thread);
Unlock sibling tree structure.
Since: 2.0.0
void
ags_thread_unlock_children (AgsThread *thread);
Unlock child tree structure.
Since: 2.0.0
void ags_thread_wait_parent (AgsThread *thread,AgsThread *parent);
Wait on parent tree structure.
Since: 2.0.0
void
ags_thread_wait_sibling (AgsThread *thread);
Wait on sibling tree structure.
Since: 2.0.0
void
ags_thread_wait_children (AgsThread *thread);
Wait on child tree structure.
Since: 2.0.0
void ags_thread_signal_parent (AgsThread *thread,AgsThread *parent,gboolean broadcast);
Signals the tree in higher levels.
Since: 2.0.0
void ags_thread_signal_sibling (AgsThread *thread,gboolean broadcast);
Signals the tree on same level.
Since: 2.0.0
void ags_thread_signal_children (AgsThread *thread,gboolean broadcast);
Signals the tree in lower levels.
Since: 2.0.0
void ags_thread_add_start_queue (AgsThread *thread,AgsThread *child);
Add child
to thread
's start queue.
Since: 2.0.0
void ags_thread_add_start_queue_all (AgsThread *thread,GList *child);
Add child
to thread
's start queue.
Since: 2.0.0
gboolean
ags_thread_is_running (AgsThread *thread);
Query running flag.
Since: 2.0.0
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: 2.0.0
void
ags_thread_stop (AgsThread *thread);
Stop the threads loop by unsetting AGS_THREAD_RUNNING flag.
Since: 2.0.0
guint ags_thread_interrupted (AgsThread *thread,int sig,guint time_cycle,guint *time_spent);
Notify to resume interrupted thread.
thread |
the AgsThread |
|
sig |
signal number |
|
time_cycle |
duration of the time cycle |
|
time_spent |
time spent since last cycle |
Since: 2.0.0
void
ags_thread_hangcheck (AgsThread *thread);
Performs hangcheck of thread.
Since: 2.0.0
AgsThread *
ags_thread_chaos_tree (AgsThread *thread);
Escape chaos tree, get syncing point.
Since: 2.0.0
gboolean ags_thread_is_chaos_tree (AgsThread *thread,guint tic_delay,gboolean is_chaos_tree);
Check chaos tree and flag threads.
thread |
the AgsThread |
|
tic_delay |
the tic to sync with |
|
is_chaos_tree |
if |
Since: 2.0.0
AgsThread *
ags_thread_new (gpointer data);
Create a new instance of AgsThread you may provide a gpointer as data
to your thread routine.
Since: 2.0.0
#define AGS_THREAD(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_THREAD, AgsThread))
#define AGS_THREAD_CLASS(class) (G_TYPE_CHECK_CLASS_CAST(class, AGS_TYPE_THREAD, AgsThreadClass))
#define AGS_THREAD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS(obj, AGS_TYPE_THREAD, AgsThreadClass))
Enum values to control the behavior or indicate internal state of AgsThread by enable/disable as flags.
|
the thread was added to registry, see |
||
|
the thread was connected by |
||
|
the thread doesn't actually run in its owns thread |
||
|
initial sync indicates the thread wasn't synced before |
||
|
the first call to |
||
|
realtime setup was performed |
||
|
the thread is waiting |
||
|
the thread is running |
||
|
the thread is in idle mode |
||
|
the thread is locked |
||
|
the thread is suspended |
||
|
the thread is ready |
||
|
call |
||
|
the thread is not synced |
||
|
do sync immediately |
||
|
check if thread was interrupted |
||
|
call |
||
|
do timing |
||
|
intermediate pre sync to parent thread |
||
|
intermediate post sync to parent thread |
Enum values to control the behavior or indicate internal state of AgsThread by enable/disable as sync_flags.
|
wait for parent |
||
|
wait for sibling |
||
|
wait for children |
||
|
wait for barrier |
||
|
the thread is waiting for parent |
||
|
the thread is waiting for sibling |
||
|
the thread is waiting for children |
||
|
the thread is waiting for barrier |
||
|
broadcast parent |
||
|
broadcast sibling |
||
|
broadcast children |
||
|
exclusively synced tic group |
||
|
wait tree to be synced |
||
|
exclusively synced tic group |
||
|
wait tree to be synced |
||
|
exclusively synced tic group |
||
|
wait tree to be synced |
||
|
run timelock |
||
|
timelock wait |
||
|
timelock resume |
||
|
skip non greedy |
||
|
thread was skipped by timelock |
||
|
you shall lock run mutex of greedy locks |
||
|
sync frequency as starting thread |
||
|
the frequency was synced |
||
|
the thread is interrupted |
||
|
the thread is monitoring interrupts |
||
|
wait exclusive async running queue |
||
|
done exclusive async running queue |
||
struct AgsThreadClass {
GObjectClass object;
guint (*clock)(AgsThread *thread);
void (*start)(AgsThread *thread);
void (*run)(AgsThread *thread);
void (*suspend)(AgsThread *thread);
void (*resume)(AgsThread *thread);
void (*timelock)(AgsThread *thread);
void (*stop)(AgsThread *thread);
guint (*interrupted)(AgsThread *thread,
int sig,
guint time_cycle, guint *time_spent);
};
“frequency” property “frequency” gdouble
The frequency to run at in Hz.
Flags: Read / Write
Allowed values: [0.01,1000]
Default value: 250
Since: 2.0.0
“clock” signalguint user_function (AgsThread *thread, gpointer user_data)
The ::clock() signal is invoked every thread tic.
Flags: Run Last
Since: 2.0.0
“interrupted” signalguint user_function (AgsThread *thread, gint sig, guint time_cycle, gpointer time_spent, gpointer user_data)
The ::interrupted() signal is invoked as thread
should resume from interrupt.
thread |
the AgsThread |
|
sig |
the signal number |
|
time_cycle |
the cycles duration |
|
time_spent |
the time spent |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 2.0.0
“resume” signalvoid user_function (AgsThread *thread, gpointer user_data)
The ::resume() signal is invoked during resuming.
Flags: Run Last
Since: 2.0.0
“run” signalvoid user_function (AgsThread *thread, gpointer user_data)
The ::run() signal is invoked during run loop.
Flags: Run Last
Since: 2.0.0
“start” signalvoid user_function (AgsThread *thread, gpointer user_data)
The ::start() signal is invoked as thread started.
Flags: Run Last
Since: 2.0.0
“stop” signalvoid user_function (AgsThread *thread, gpointer user_data)
The ::stop() signal is invoked as thread
stopped.
Flags: Run Last
Since: 2.0.0
“suspend” signalvoid user_function (AgsThread *thread, gpointer user_data)
The ::suspend() signal is invoked during suspending.
Flags: Run Last
Since: 2.0.0