On Sat, Jul 7, 2012 at 5:50 AM, zentara <[email protected]> wrote:

> On Fri, 06 Jul 2012 18:44:01 +0200
> Fabio D'Alfonso <[email protected]> wrote:
>
> >Hi,
> >below it is a copy of a comment I made after David Mertens commented on
> >one of my posts on Prima.
>
>
> >Any comment to this is welcome.
> >
>
> Hi,
> I'm interested in different GUI toolkits, and just started looking
> at Prima.
>
> My one question is this:  Is Prima threadsafe? Or are there methods to use
> so that a programmer can access a Prima widget from a thread?
>

Prima is not thread safe. I have pondered addressing this issue and I
suspect that if you looked into the matter and offered a (cross-platform)
patch to Prima that would allow it to be Perl thread-safe, Dmitry would be
delighted. Don't take my word for it---I'm not Dmitry---but it's the rare
open source developer who would reject such a useful and nontrivial patch.

Tk is known to be NOT threadsafe, with a bunch of well known hacks
> for dealing with the problem.
>
> Gtk2 has improved thread safety, and you can safely access a Gtk2 widget
> from a thread with an Glib::Idle->add().
>
> How does Prima fit into this, because it would seem that using it with PDL
> would often need the PDL routines running in a thread, so as not to
> interfere
> with the GUI event-loop.
>

Yes... well... I have actually written PDL::PP code with optional callbacks
so that I could update the GUI interface of my program during lengthy
calculations. Such a callback interface is useful for any sort of lengthy
PDL operation (even if only for printing status updates to the terminal)
but they are not implemented in any of our routines. This is one of the
sorts of things that I intend to cover if I ever get to writing a second
chapter on PDL::PP for PDL::Book.

So to answer your question, threadsafe Prima would make all of this much
easier, but it's not strictly required to maintain a responsive user
interface.


> Thanks for reading this.
>
> 0m,
> zentara
>

You're welcome. :-)
David

-- 
 "Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it." -- Brian Kernighan
_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to