source: appstream-generator/build/girepo/gio/IOSchedulerJob.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 4.5 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software 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 Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.IOSchedulerJob;
22
23private import gi.gio;
24public  import gi.giotypes;
25private import gio.Cancellable;
26
27
28/**
29 * Opaque class for defining and scheduling IO jobs.
30 */
31public class IOSchedulerJob
32{
33        /** the main Gtk struct */
34        protected GIOSchedulerJob* gIOSchedulerJob;
35        protected bool ownedRef;
36
37        /** Get the main Gtk struct */
38        public GIOSchedulerJob* getIOSchedulerJobStruct()
39        {
40                return gIOSchedulerJob;
41        }
42
43        /** the main Gtk struct as a void* */
44        protected void* getStruct()
45        {
46                return cast(void*)gIOSchedulerJob;
47        }
48
49        /**
50         * Sets our main struct and passes it to the parent class.
51         */
52        public this (GIOSchedulerJob* gIOSchedulerJob, bool ownedRef = false)
53        {
54                this.gIOSchedulerJob = gIOSchedulerJob;
55                this.ownedRef = ownedRef;
56        }
57
58
59        /**
60         * Used from an I/O job to send a callback to be run in the thread
61         * that the job was started from, waiting for the result (and thus
62         * blocking the I/O job).
63         *
64         * Deprecated: Use g_main_context_invoke().
65         *
66         * Params:
67         *     func = a #GSourceFunc callback that will be called in the original thread
68         *     userData = data to pass to @func
69         *     notify = a #GDestroyNotify for @user_data, or %NULL
70         *
71         * Returns: The return value of @func
72         */
73        public bool sendToMainloop(GSourceFunc func, void* userData, GDestroyNotify notify)
74        {
75                return g_io_scheduler_job_send_to_mainloop(gIOSchedulerJob, func, userData, notify) != 0;
76        }
77
78        /**
79         * Used from an I/O job to send a callback to be run asynchronously in
80         * the thread that the job was started from. The callback will be run
81         * when the main loop is available, but at that time the I/O job might
82         * have finished. The return value from the callback is ignored.
83         *
84         * Note that if you are passing the @user_data from g_io_scheduler_push_job()
85         * on to this function you have to ensure that it is not freed before
86         * @func is called, either by passing %NULL as @notify to
87         * g_io_scheduler_push_job() or by using refcounting for @user_data.
88         *
89         * Deprecated: Use g_main_context_invoke().
90         *
91         * Params:
92         *     func = a #GSourceFunc callback that will be called in the original thread
93         *     userData = data to pass to @func
94         *     notify = a #GDestroyNotify for @user_data, or %NULL
95         */
96        public void sendToMainloopAsync(GSourceFunc func, void* userData, GDestroyNotify notify)
97        {
98                g_io_scheduler_job_send_to_mainloop_async(gIOSchedulerJob, func, userData, notify);
99        }
100
101        /**
102         * Cancels all cancellable I/O jobs.
103         *
104         * A job is cancellable if a #GCancellable was passed into
105         * g_io_scheduler_push_job().
106         *
107         * Deprecated: You should never call this function, since you don't
108         * know how other libraries in your program might be making use of
109         * gioscheduler.
110         */
111        public static void cancelAllJobs()
112        {
113                g_io_scheduler_cancel_all_jobs();
114        }
115
116        /**
117         * Schedules the I/O job to run in another thread.
118         *
119         * @notify will be called on @user_data after @job_func has returned,
120         * regardless whether the job was cancelled or has run to completion.
121         *
122         * If @cancellable is not %NULL, it can be used to cancel the I/O job
123         * by calling g_cancellable_cancel() or by calling
124         * g_io_scheduler_cancel_all_jobs().
125         *
126         * Deprecated: use #GThreadPool or g_task_run_in_thread()
127         *
128         * Params:
129         *     jobFunc = a #GIOSchedulerJobFunc.
130         *     userData = data to pass to @job_func
131         *     notify = a #GDestroyNotify for @user_data, or %NULL
132         *     ioPriority = the [I/O priority][io-priority]
133         *         of the request.
134         *     cancellable = optional #GCancellable object, %NULL to ignore.
135         */
136        public static void pushJob(GIOSchedulerJobFunc jobFunc, void* userData, GDestroyNotify notify, int ioPriority, Cancellable cancellable)
137        {
138                g_io_scheduler_push_job(jobFunc, userData, notify, ioPriority, (cancellable is null) ? null : cancellable.getCancellableStruct());
139        }
140}
Note: See TracBrowser for help on using the repository browser.