GTaskScheduler

GTaskScheduler — Scheduling of tasks

Synopsis

                    GTaskScheduler;
GTaskScheduler*     g_task_scheduler_get_default        (void);
GTaskScheduler*     g_task_scheduler_new                (void);
void                g_task_scheduler_schedule           (GTaskScheduler *self,
                                                         GTask *task);

Object Hierarchy

  GObject
   +----GTaskScheduler

Properties

  "main-dispatch"            gboolean              : Read / Write

Description

GTaskScheduler provides management over how tasks are executed. It can be inherited and tuned for particular problem sets.

However, the API as it is now will be going through a series of changes in the time ahead. So keep that in mind.

The base GTaskScheduler implementation uses a GThreadPool internally to execute the tasks. Thread management may well be pulled out of the scheduler soon so that it may concentrate on more important things.

Details

GTaskScheduler

typedef struct _GTaskScheduler GTaskScheduler;


g_task_scheduler_get_default ()

GTaskScheduler*     g_task_scheduler_get_default        (void);

Gets the default GTaskScheduler for the process.

Returns :

A GTaskScheduler

g_task_scheduler_new ()

GTaskScheduler*     g_task_scheduler_new                (void);

Creates a new instance of GTaskScheduler. This default scheduler uses a GThreadPool for task execution.

Returns :

A new GTaskScheduler.

g_task_scheduler_schedule ()

void                g_task_scheduler_schedule           (GTaskScheduler *self,
                                                         GTask *task);

This method will schedule a task to be executed on a thread of execution. The default GTaskScheduler implementation uses a GThreadPool to perform the task. g_task_execute() will be called from within the executing thread.

self :

A GTaskScheduler

task :

The GTask to schedule

Property Details

The "main-dispatch" property

  "main-dispatch"            gboolean              : Read / Write

The main-dispatch property determines if tasks processed by the scheduler should perform callbacks inside of the main thread.

The default value is TRUE.

By performing callbacks in the main thread, gtk+ developers can avoid the task of acquiring the GDK thread lock as their dispatching thread will already own it.

Default value: TRUE