1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "unsafe"
6
7 "github.com/ebitengine/purego"
8
9 "github.com/bnema/puregotk/pkg/core"
10 "github.com/bnema/puregotk/v4/glib"
11)
12
13var xIoSchedulerCancelAllJobs func()
14
15// Cancels all cancellable I/O jobs.
16//
17// A job is cancellable if a #GCancellable was passed into
18// g_io_scheduler_push_job().
19func IoSchedulerCancelAllJobs() {
20
21 xIoSchedulerCancelAllJobs()
22
23}
24
25var xIoSchedulerPushJob func(uintptr, uintptr, uintptr, int, uintptr)
26
27// Schedules the I/O job to run in another thread.
28//
29// @notify will be called on @user_data after @job_func has returned,
30// regardless whether the job was cancelled or has run to completion.
31//
32// If @cancellable is not %NULL, it can be used to cancel the I/O job
33// by calling g_cancellable_cancel() or by calling
34// g_io_scheduler_cancel_all_jobs().
35func IoSchedulerPushJob(JobFuncVar *IOSchedulerJobFunc, UserDataVar uintptr, NotifyVar *glib.DestroyNotify, IoPriorityVar int, CancellableVar *Cancellable) {
36
37 var JobFuncVarRef uintptr
38 if JobFuncVar != nil {
39 JobFuncVarPtr := uintptr(unsafe.Pointer(JobFuncVar))
40 if cbRefPtr, ok := glib.GetCallback(JobFuncVarPtr); ok {
41 JobFuncVarRef = cbRefPtr
42 } else {
43 fcb := func(arg0 *IOSchedulerJob, arg1 uintptr, arg2 uintptr) bool {
44 cbFn := *JobFuncVar
45 return cbFn(arg0, arg1, arg2)
46 }
47 JobFuncVarRef = purego.NewCallback(fcb)
48 glib.SaveCallbackWithClosure(JobFuncVarPtr, JobFuncVarRef, JobFuncVar)
49 }
50 }
51
52 var NotifyVarRef uintptr
53 if NotifyVar != nil {
54 NotifyVarPtr := uintptr(unsafe.Pointer(NotifyVar))
55 if cbRefPtr, ok := glib.GetCallback(NotifyVarPtr); ok {
56 NotifyVarRef = cbRefPtr
57 } else {
58 fcb := func(arg0 uintptr) {
59 cbFn := *NotifyVar
60 cbFn(arg0)
61 }
62 NotifyVarRef = purego.NewCallback(fcb)
63 glib.SaveCallbackWithClosure(NotifyVarPtr, NotifyVarRef, NotifyVar)
64 }
65 }
66
67 xIoSchedulerPushJob(JobFuncVarRef, UserDataVar, NotifyVarRef, IoPriorityVar, CancellableVar.GoPointer())
68
69}
70
71func init() {
72 core.SetPackageName("GIO", "gio-2.0")
73 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
74 var libs []uintptr
75 for _, libPath := range core.GetPaths("GIO") {
76 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
77 if err != nil {
78 panic(err)
79 }
80 libs = append(libs, lib)
81 }
82
83 core.PuregoSafeRegister(&xIoSchedulerCancelAllJobs, libs, "g_io_scheduler_cancel_all_jobs")
84 core.PuregoSafeRegister(&xIoSchedulerPushJob, libs, "g_io_scheduler_push_job")
85
86}