Re: GIOScheduler example need



    The prototypes of GIOSchedulerJob func is :
gboolean func(GIOSchedulerJob*, GCancallabel*, gpointer);

If you want to pass some data to that function use a structure as it's user_data, for example.

struct data {
    int a, b;
};

gboolean job_func(GIOScheduler *job, GCancellable *cancellable, gpointer user_data)
{
    struct data *data = (struct data*) user_data;
    ...
}

...
/*
 * Caller function.
 * Either by use pointer to struct data and allocate it or by unary operator.
 * We use unary operator here to directly give the address.
 */
struct data data;
g_io_scheduler_push_job(job_func, &data, notify_func, prio, cancellable);
....

Notice you will get many function like this in GTK+, it's important to cleary understand this method.

        Ardhan,


--- kuleshovmail gmail com wrote:

From: Alexander Kuleshov <kuleshovmail gmail com>
To: ajhwb knac com
Cc: gtk-app-devel-list gnome org
Subject: Re: GIOScheduler example need
Date: Fri, 25 Jun 2010 14:36:01 +0600

And if i whave functions with some parametes?

For example:

static gboolean job_func(int a, int b)
{
  ...
}

How can i send parameters in   g_io_scheduler_push_job?

Thank you




_____________________________________________________________
Listen to KNAC, Hit the Home page and Tune In Live! ---> http://www.knac.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]