UDisksThreadedJob

## UDisksThreadedJob UDisksThreadedJob — Job that runs in a thread |

## Synopsis

                        UDisksThreadedJob;
    gboolean            (*UDisksThreadedJobFunc)            (UDisksThreadedJob *job,
                                                             GCancellable *cancellable,
                                                             gpointer user_data,
                                                             GError **error);
    UDisksThreadedJob * udisks_threaded_job_new             (UDisksThreadedJobFunc job_func,
                                                             gpointer user_data,
                                                             GDestroyNotify user_data_free_func,
                                                             GCancellable *cancellable);
    gpointer            udisks_threaded_job_get_user_data   (UDisksThreadedJob *job);

## Object Hierarchy

      GObject
       +----GDBusInterfaceSkeleton
             +----UDisksJobSkeleton
                   +----UDisksBaseJob
                         +----UDisksThreadedJob

## Implemented Interfaces

UDisksThreadedJob implements GDBusInterface and UDisksJob.

## Properties

      "job-func"                 gpointer              : Read / Write / Construct Only
      "user-data"                gpointer              : Read / Write / Construct Only
      "user-data-free-func"      gpointer              : Read / Write / Construct Only

## Signals

      "threaded-job-completed"                         : Run Last

## Description

This type provides an implementation of the UDisksJob interface for jobs that run in a thread.

## Details

### UDisksThreadedJob

    typedef struct _UDisksThreadedJob UDisksThreadedJob;

The UDisksThreadedJob structure contains only private data and should only be accessed using the provided API.

### UDisksThreadedJobFunc ()

    gboolean            (*UDisksThreadedJobFunc)            (UDisksThreadedJob *job,
                                                             GCancellable *cancellable,
                                                             gpointer user_data,
                                                             GError **error);

Job function that runs in a separate thread.

Long-running jobs should periodically check `cancellable` to see if they have been cancelled.

`job` : | A UDisksThreadedJob.
`cancellable` : | A GCancellable (never `NULL`).
`user_data` : | User data passed when creating `job`.
`error` : | Return location for error (never `NULL`).
Returns : | `TRUE` if the job succeeded, `FALSE` if `error` is set.

### udisks_threaded_job_new ()

    UDisksThreadedJob * udisks_threaded_job_new             (UDisksThreadedJobFunc job_func,
                                                             gpointer user_data,
                                                             GDestroyNotify user_data_free_func,
                                                             GCancellable *cancellable);

Creates a new UDisksThreadedJob instance.

The job is started immediately - connect to the "threaded-job-completed" or "completed" signals to get notified when the job is done.

`job_func` : | The function to run in another thread.
`user_data` : | User data to pass to `job_func`.
`user_data_free_func` : | Function to free `user_data` with or `NULL`.
`cancellable` : | A GCancellable or `NULL`.
Returns : | A new UDisksThreadedJob. Free with `g_object_unref()`.

### udisks_threaded_job_get_user_data ()

    gpointer            udisks_threaded_job_get_user_data   (UDisksThreadedJob *job);

Gets the `user_data` parameter that `job` was constructed with.

`job` : | A UDisksThreadedJob.
Returns : | A gpointer owned by `job`.

## Property Details

### The `"job-func"` property

      "job-func"                 gpointer              : Read / Write / Construct Only

The UDisksThreadedJobFunc to use.

### The `"user-data"` property

      "user-data"                gpointer              : Read / Write / Construct Only

User data for the UDisksThreadedJobFunc.

### The `"user-data-free-func"` property

      "user-data-free-func"      gpointer              : Read / Write / Construct Only

Free function for user data for the UDisksThreadedJobFunc.

## Signal Details

### The `"threaded-job-completed"` signal

    gboolean            user_function                      (UDisksThreadedJob *job,
                                                            gboolean           result,
                                                            GError            *error,
                                                            gpointer           user_data)      : Run Last

Emitted when the threaded job is complete.

The default implementation simply emits the "completed" signal with `success` set to `TRUE` if, and only if, `error` is `NULL`. Otherwise, `message` on that signal is set to a string describing `error`. You can avoid the default implementation by returning `TRUE` from your signal handler.

This signal is emitted in the thread-default main loop of the thread that `job` was created in.

`job` : | The UDisksThreadedJob emitting the signal.
`result` : | The gboolean returned by the UDisksThreadedJobFunc.
`error` : | The GError set by the UDisksThreadedJobFunc.
`user_data` : | user data set when the signal handler was connected.
Returns : | `TRUE` if the signal was handled, `FALSE` to let other handlers run.