Glib threads in gtk-perl?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Glib threads in gtk-perl?

Mike Martin-5
Hi
It was suggested that I look into using glib threads after posting theĀ  problem below to gtk-list

I keep getting method not found when I try to create threads using
Glib::ThreadPool->new or
Glib::Thread->new

Are g_threads not implemented?

Alternately any other ideas on the issue

thanks


Mike

Hi
I have a weird issue on an application I am developing

The application is fully tabbed and runs loops to transcode video files, and I would like to be able to run the main transcoding loop fully in parrellel, ie: the process running in one tab is totally seperate to that running in another tab

I have tried this on the key sub (simplified)


sub encode_loop {
my ($optsi,$prog,$ext,$action_
grid,$dvb,$type_g,$files,$video_type)=@_;
my $mainloop = Glib::MainLoop->new;
my $subname='encode';
Gtk3::main_iteration_do(0);

my $progrun=&run_cmd($files->{$
file_id},$opts,$prog,$ext,$subname,$action_grid,,0) ;#if $dvb!~/ogg/ ;
$mainloop->quit
return 1
}

However this is what happens.

I start one loop running, then open another tab and set another loop running.

For the first file every works fine.

Then however

When the first file finishes encoding, the loop stops until the second loop is finished.

AND

The second loop transcodes multiple files at the same time instead of sequentially. The number is equal to the number of loops running, ie: if two tabs are running the encode process, then two files are encoded simultaneously, tree tabs than three files


_______________________________________________
gtk-perl-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Glib threads in gtk-perl?

Brian Manning-2
On Tue, Mar 14, 2017 at 4:24 AM, Mike Martin <[hidden email]> wrote:

> Hi
> It was suggested that I look into using glib threads after posting the
> problem below to gtk-list
>
> I keep getting method not found when I try to create threads using
> Glib::ThreadPool->new or
> Glib::Thread->new
>
> Are g_threads not implemented?
>
> Alternately any other ideas on the issue

GThreads are used in Perl Glib, but only to manage Glib data
structures, not to manage threads themselves; threads should be
created/managed using the Perl 'threads' module [1][2].

You should also run 'perl -V | grep ithreads' to check to see if your
Perl is compiled with thread support, the output of the above command
should say 'useithreads=define'.

There's also a FAQ question about using threads in Gtk-Perl at [3].

Thanks,

Brian

[1] http://perldoc.perl.org/perlthrtut.html
[2] https://metacpan.org/pod/threads
[3] https://wiki.gnome.org/Projects/GTK-Perl/FrequentlyAskedQuestions#Can_I_use_threads_with_Gtk2-Perl.3F
_______________________________________________
gtk-perl-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list
Reply | Threaded
Open this post in threaded view
|

Re: Glib threads in gtk-perl?

Mike Martin-5
Suspected as much. Looks like it's back to square one.

On 15 Mar 2017 3:08 p.m., "Brian Manning" <[hidden email]> wrote:
On Tue, Mar 14, 2017 at 4:24 AM, Mike Martin <[hidden email]> wrote:
> Hi
> It was suggested that I look into using glib threads after posting the
> problem below to gtk-list
>
> I keep getting method not found when I try to create threads using
> Glib::ThreadPool->new or
> Glib::Thread->new
>
> Are g_threads not implemented?
>
> Alternately any other ideas on the issue

GThreads are used in Perl Glib, but only to manage Glib data
structures, not to manage threads themselves; threads should be
created/managed using the Perl 'threads' module [1][2].

You should also run 'perl -V | grep ithreads' to check to see if your
Perl is compiled with thread support, the output of the above command
should say 'useithreads=define'.

There's also a FAQ question about using threads in Gtk-Perl at [3].

Thanks,

Brian

[1] http://perldoc.perl.org/perlthrtut.html
[2] https://metacpan.org/pod/threads
[3] https://wiki.gnome.org/Projects/GTK-Perl/FrequentlyAskedQuestions#Can_I_use_threads_with_Gtk2-Perl.3F
_______________________________________________
gtk-perl-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list

_______________________________________________
gtk-perl-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-perl-list