AgsWorkerThread

AgsWorkerThread — worker thread class discarding base frequency

Stability Level

Stable, unless otherwise indicated

Functions

Signals

void do-poll Run Last

Types and Values

Object Hierarchy

    GFlags
    ╰── AgsWorkerThreadStatusFlags
    GObject
    ╰── AgsThread
        ╰── AgsWorkerThread
            ╰── AgsDestroyWorker

Includes

#include <ags/thread/ags_worker_thread.h>

Description

The AgsWorkerThread does non-realtime work. You might want to synchronize to the run signal within your ::do_poll() method.

You usually connect to AgsThread::do_poll() event. The poll event is invoked as long as AGS_WORKER_THREAD_STATUS_RUNNING status flag is set.

You might want to inject to a thread tree using a AgsTask implementation.

Functions

ags_worker_thread_test_status_flags ()

gboolean
ags_worker_thread_test_status_flags (AgsWorkerThread *worker_thread,
                                     AgsWorkerThreadStatusFlags status_flags);

Test status_flags of worker_thread .

Parameters

worker_thread

the AgsWorkerThread

 

status_flags

status flags

 

Returns

TRUE if status flags set, otherwise FALSE

Since: 3.0.0


ags_worker_thread_set_status_flags ()

void
ags_worker_thread_set_status_flags (AgsWorkerThread *worker_thread,
                                    AgsWorkerThreadStatusFlags status_flags);

Set status flags.

Parameters

worker_thread

the AgsWorkerThread

 

status_flags

status flags

 

Since: 3.0.0


ags_worker_thread_unset_status_flags ()

void
ags_worker_thread_unset_status_flags (AgsWorkerThread *worker_thread,
                                      AgsWorkerThreadStatusFlags status_flags);

Unset status flags.

Parameters

worker_thread

the AgsWorkerThread

 

status_flags

status flags

 

Since: 3.0.0


ags_woker_thread_do_poll_loop ()

void *
ags_woker_thread_do_poll_loop (void *ptr);

Do loop and invoke ags_worker_thread_do_poll() unless flag AGS_WORKER_THREAD_RUNNING was unset.

Parameters

ptr

the AgsWorkerThread

 

Since: 3.0.0


ags_worker_thread_do_poll ()

void
ags_worker_thread_do_poll (AgsWorkerThread *worker_thread);

Do poll your work. It is called of the worker thread.

Parameters

worker_thread

the AgsWorkerThread

 

Since: 3.0.0


ags_worker_thread_new ()

AgsWorkerThread *
ags_worker_thread_new ();

Create a new instance of AgsWorkerThread.

Returns

the new AgsWorkerThread

Since: 3.0.0

Types and Values

AGS_WORKER_THREAD_DEFAULT_JIFFIE

#define AGS_WORKER_THREAD_DEFAULT_JIFFIE (AGS_THREAD_DEFAULT_MAX_PRECISION)

enum AgsWorkerThreadStatusFlags

Enum values to control the behavior or indicate internal state of AgsWorkerThread by enable/disable as status flags.

Members

AGS_WORKER_THREAD_STATUS_RUNNING

the worker is running

 

AGS_WORKER_THREAD_STATUS_RUN_WAIT

sync wait

 

AGS_WORKER_THREAD_STATUS_RUN_DONE

sync done

 

AGS_WORKER_THREAD_STATUS_RUN_SYNC

do sync

 

Signal Details

The “do-poll” signal

void
user_function (AgsWorkerThread *thread,
               gpointer         user_data)

The ::do_poll() signal runs independently of ::run() but might be synchronized using a conditional lock.

Parameters

thread

the AgsWorkerThread

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 3.0.0