AgsThread

AgsThread — threads

Functions

#define AGS_ACCOUNTING_TABLE()
#define MSEC_PER_SEC
#define NSEC_PER_SEC
#define AGS_THREAD_DEFAULT_JIFFIE
#define AGS_THREAD_MAX_PRECISION
#define AGS_THREAD_DEFAULT_ATTACK
AgsAccountingTable * ags_accounting_table_alloc ()
void ags_accounting_table_set_sanity ()
void ags_thread_set_sync ()
void ags_thread_set_sync_all ()
void ags_thread_lock ()
gboolean ags_thread_trylock ()
void ags_thread_unlock ()
AgsThread * ags_thread_get_toplevel ()
AgsThread * ags_thread_first ()
AgsThread * ags_thread_last ()
void ags_thread_remove_child ()
void ags_thread_add_child ()
gboolean ags_thread_parental_is_locked ()
gboolean ags_thread_sibling_is_locked ()
gboolean ags_thread_children_is_locked ()
gboolean ags_thread_is_current_ready ()
gboolean ags_thread_is_tree_ready ()
AgsThread * ags_thread_next_parent_locked ()
AgsThread * ags_thread_next_sibling_locked ()
AgsThread * ags_thread_next_children_locked ()
void ags_thread_lock_parent ()
void ags_thread_lock_sibling ()
void ags_thread_lock_children ()
void ags_thread_lock_all ()
void ags_thread_unlock_parent ()
void ags_thread_unlock_sibling ()
void ags_thread_unlock_children ()
void ags_thread_unlock_all ()
void ags_thread_wait_parent ()
void ags_thread_wait_sibling ()
void ags_thread_wait_children ()
void ags_thread_signal_parent ()
void ags_thread_signal_sibling ()
void ags_thread_signal_children ()
void ags_thread_start ()
void ags_thread_run ()
void ags_thread_suspend ()
void ags_thread_resume ()
void ags_thread_timelock ()
void ags_thread_stop ()
void ags_thread_hangcheck ()
AgsThread * ags_thread_new ()

Types and Values

Includes

#include <ags/thread/ags_thread.h>

Description

The AgsThread base class. It supports organizing them within a tree, perform syncing and frequencies.

Functions

AGS_ACCOUNTING_TABLE()

#define AGS_ACCOUNTING_TABLE(ptr) ((AgsAccountingTable *)(ptr))


MSEC_PER_SEC

#define             MSEC_PER_SEC


NSEC_PER_SEC

#define             NSEC_PER_SEC


AGS_THREAD_DEFAULT_JIFFIE

#define AGS_THREAD_DEFAULT_JIFFIE (250)


AGS_THREAD_MAX_PRECISION

#define AGS_THREAD_MAX_PRECISION (1000)


AGS_THREAD_DEFAULT_ATTACK

#define AGS_THREAD_DEFAULT_ATTACK (1.0)


ags_accounting_table_alloc ()

AgsAccountingTable *
ags_accounting_table_alloc (AgsThread *thread);

Returns


ags_accounting_table_set_sanity ()

void
ags_accounting_table_set_sanity (GList *table,
                                 AgsThread *thread,
                                 gdouble sanity);


ags_thread_set_sync ()

void
ags_thread_set_sync (AgsThread *thread,
                     guint tic);

Calls ags_thread_set_sync() on all threads.

Since 0.4


ags_thread_set_sync_all ()

void
ags_thread_set_sync_all (AgsThread *thread,
                         guint tic);


ags_thread_lock ()

void
ags_thread_lock (AgsThread *thread);

Locks the threads own mutex and sets the appropriate flag.

Since 0.4


ags_thread_trylock ()

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.

Returns

Since 0.4


ags_thread_unlock ()

void
ags_thread_unlock (AgsThread *thread);

Unlocks the threads own mutex and unsets the appropriate flag.

Since 0.4


ags_thread_get_toplevel ()

AgsThread *
ags_thread_get_toplevel (AgsThread *thread);

Retrieve toplevel thread.

Returns

Since 0.4


ags_thread_first ()

AgsThread *
ags_thread_first (AgsThread *thread);

Retrieve first sibling.

Returns

Since 0.4


ags_thread_last ()

AgsThread *
ags_thread_last (AgsThread *thread);

Retrieve last sibling.

Returns

Since 0.4


ags_thread_remove_child ()

void
ags_thread_remove_child (AgsThread *thread,
                         AgsThread *child);

Remove child of thread.

Since 0.4


ags_thread_add_child ()

void
ags_thread_add_child (AgsThread *thread,
                      AgsThread *child);

Add child to thread.

Since 0.4


ags_thread_parental_is_locked ()

gboolean
ags_thread_parental_is_locked (AgsThread *thread,
                               AgsThread *parent);

Check the AGS_THREAD_LOCKED flag in parental levels.

Returns

Since 0.4


ags_thread_sibling_is_locked ()

gboolean
ags_thread_sibling_is_locked (AgsThread *thread);

Check the AGS_THREAD_LOCKED flag within sibling.

Returns

Since 0.4


ags_thread_children_is_locked ()

gboolean
ags_thread_children_is_locked (AgsThread *thread);

Check the AGS_THREAD_LOCKED flag within children.

Returns

Since 0.4


ags_thread_is_current_ready ()

gboolean
ags_thread_is_current_ready (AgsThread *current);

Returns


ags_thread_is_tree_ready ()

gboolean
ags_thread_is_tree_ready (AgsThread *thread);

Returns


ags_thread_next_parent_locked ()

AgsThread *
ags_thread_next_parent_locked (AgsThread *thread,
                               AgsThread *parent);

Retrieve next locked thread above thread .

Returns

Since 0.4


ags_thread_next_sibling_locked ()

AgsThread *
ags_thread_next_sibling_locked (AgsThread *thread);

Retrieve next locked thread neighbooring thread

Returns

Since 0.4


ags_thread_next_children_locked ()

AgsThread *
ags_thread_next_children_locked (AgsThread *thread);

Retrieve next locked thread following thread

Returns

Since 0.4


ags_thread_lock_parent ()

void
ags_thread_lock_parent (AgsThread *thread,
                        AgsThread *parent);

Lock parent tree structure.

Since 0.4


ags_thread_lock_sibling ()

void
ags_thread_lock_sibling (AgsThread *thread);

Lock sibling tree structure.

Since 0.4


ags_thread_lock_children ()

void
ags_thread_lock_children (AgsThread *thread);

Lock child tree structure.

Since 0.4


ags_thread_lock_all ()

void
ags_thread_lock_all (AgsThread *thread);


ags_thread_unlock_parent ()

void
ags_thread_unlock_parent (AgsThread *thread,
                          AgsThread *parent);

Unlock parent tree structure.

Since 0.4


ags_thread_unlock_sibling ()

void
ags_thread_unlock_sibling (AgsThread *thread);

Unlock sibling tree structure.

Since 0.4


ags_thread_unlock_children ()

void
ags_thread_unlock_children (AgsThread *thread);

Unlock child tree structure.

Since 0.4


ags_thread_unlock_all ()

void
ags_thread_unlock_all (AgsThread *thread);


ags_thread_wait_parent ()

void
ags_thread_wait_parent (AgsThread *thread,
                        AgsThread *parent);

Wait on parent tree structure.

Since 0.4


ags_thread_wait_sibling ()

void
ags_thread_wait_sibling (AgsThread *thread);

Wait on sibling tree structure.

Since 0.4


ags_thread_wait_children ()

void
ags_thread_wait_children (AgsThread *thread);

Wait on child tree structure.

Since 0.4


ags_thread_signal_parent ()

void
ags_thread_signal_parent (AgsThread *thread,
                          AgsThread *parent,
                          gboolean broadcast);

Signals the tree in higher levels.

Since 0.4


ags_thread_signal_sibling ()

void
ags_thread_signal_sibling (AgsThread *thread,
                           gboolean broadcast);

Signals the tree on same level.

Since 0.4


ags_thread_signal_children ()

void
ags_thread_signal_children (AgsThread *thread,
                            gboolean broadcast);

Signals the tree in lower levels.

Since 0.4


ags_thread_start ()

void
ags_thread_start (AgsThread *thread);

Start the thread.

Since 0.4


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 0.4


ags_thread_suspend ()

void
ags_thread_suspend (AgsThread *thread);


ags_thread_resume ()

void
ags_thread_resume (AgsThread *thread);


ags_thread_timelock ()

void
ags_thread_timelock (AgsThread *thread);


ags_thread_stop ()

void
ags_thread_stop (AgsThread *thread);

Stop the threads loop by unsetting AGS_THREAD_RUNNING flag.

Since 0.4


ags_thread_hangcheck ()

void
ags_thread_hangcheck (AgsThread *thread);

Performs hangcheck of thread.

Since 0.4


ags_thread_new ()

AgsThread *
ags_thread_new (gpointer data);

Create a new AgsThread you may provide a gpointer as data to your thread routine.

Returns

Since 0.4

Types and Values

AGS_THREAD_RESUME_SIG

#define             AGS_THREAD_RESUME_SIG


AGS_THREAD_SUSPEND_SIG

#define             AGS_THREAD_SUSPEND_SIG


enum AgsThreadFlags

Members

AGS_THREAD_RUNNING

   

AGS_THREAD_IDLE

   

AGS_THREAD_LOCKED

   

AGS_THREAD_WAIT_FOR_PARENT

   

AGS_THREAD_WAIT_FOR_SIBLING

   

AGS_THREAD_WAIT_FOR_CHILDREN

   

AGS_THREAD_WAIT_FOR_BARRIER

   

AGS_THREAD_WAITING_FOR_PARENT

   

AGS_THREAD_WAITING_FOR_SIBLING

   

AGS_THREAD_WAITING_FOR_CHILDREN

   

AGS_THREAD_WAITING_FOR_BARRIER

   

AGS_THREAD_BROADCAST_PARENT

   

AGS_THREAD_BROADCAST_SIBLING

   

AGS_THREAD_BROADCAST_CHILDREN

   

AGS_THREAD_INITIAL_RUN

   

AGS_THREAD_TREE_SYNC_0

   

AGS_THREAD_WAIT_0

   

AGS_THREAD_TREE_SYNC_1

   

AGS_THREAD_WAIT_1

   

AGS_THREAD_TREE_SYNC_2

   

AGS_THREAD_WAIT_2

   

AGS_THREAD_TIMELOCK_RUN

   

AGS_THREAD_TIMELOCK_WAIT

   

AGS_THREAD_TIMELOCK_RESUME

   

AGS_THREAD_SKIP_NON_GREEDY

   

AGS_THREAD_SKIPPED_BY_TIMELOCK

   

AGS_THREAD_LOCK_GREEDY_RUN_MUTEX

   

AGS_THREAD_SUSPENDED

   

AGS_THREAD_SINGLE_LOOP

   

AGS_THREAD_READY

   

AGS_THREAD_UNREF_ON_EXIT

   

struct AgsAccountingTable

struct AgsAccountingTable {
  AgsThread *thread;
  gdouble sanity;
};