Not able to contruct GLib.Thread



Hi,

I started learning gjs and gobject-introspection. As per my
understanding, if I see a <record> entry with name="Thread"
in /usr/share/gir-1.0/GLib-2.0.gir, then I can create a GThread object
inside gjs.

With this, I tried to create one thread object,

#!/usr/bin/env gjs

const GLib = this.imports.gi.GLib;
var MyThread = new GLib.Thread({});
print(MyThread);


But, I'm getting this error,

Error: Unable to construct boxed type Thread since it has no zero-args
<constructor>, can only wrap an existing one

The same error appears when I do,

var MyMainLoop = new GLib.MainLoop({context: null, is_running: true});

But, I can create MainLoop with 'new' function,

var MyMainLoop = GLib.MainLoop.new(null, true);

Someone help me to understand how to create gir exported GObjects in
gjs? I'm currently using gobject-introspection-1.32.1 and gjs-1.32.0

Thanks,
Mohan R



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