2 * Copyright (C) 2005 Colin Walters <walters@verbum.org>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <glib-object.h>
27 #define RB_TYPE_THREAD (rb_thread_get_type ())
28 #define RB_THREAD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), RB_TYPE_THREAD, RBThread))
29 #define RB_THREAD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), RB_TYPE_THREAD, RBThreadClass))
30 #define RB_IS_THREAD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), RB_TYPE_THREAD))
31 #define RB_IS_THREAD_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), RB_TYPE_THREAD))
32 #define RB_THREAD_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), RB_TYPE_THREAD, RBThreadClass))
34 typedef struct RBThreadPrivate RBThreadPrivate
;
40 RBThreadPrivate
*priv
;
48 typedef gpointer (*RBThreadActionFunc
) (gpointer data
, gpointer user_data
, gint
*exit_flag
);
49 typedef void (*RBThreadResultFunc
) (gpointer data
, gpointer user_data
);
50 typedef void (*RBThreadActionDestroyFunc
) (gpointer data
, gpointer user_data
);
51 typedef void (*RBThreadResultDestroyFunc
) (gpointer result
, gpointer user_data
);
53 GType
rb_thread_get_type (void);
55 RBThread
* rb_thread_new (GMainContext
*context
,
56 RBThreadActionFunc action_cb
,
57 RBThreadResultFunc result_cb
,
58 RBThreadActionDestroyFunc action_destroy_func
,
59 RBThreadResultDestroyFunc result_destroy_func
,
62 void rb_thread_push_action (RBThread
*thread
,
65 void rb_thread_terminate (RBThread
*thread
);
69 #endif /* __RB_THREAD_H */