>Da: adamkennedybac...@gmail.com
>
>At the moment I'm using the main window as the event conduit, rather
>than wxTheApp.
>
>I started initially using the app, but when I did this I found that
>events don't succeed immediately (on Windows)

  "On Windows" means that the code worked on Linux/Mac or that
you were developing on Windows and did not check the other platforms?

>Instead, they seem to accumulate somewhere in the ether and then all
>arrive in one go when the thread exits.

  All of this while the main event loop was running?

>Another problem I encountered with using Wx::wxTheApp was that it
>wasn't giving me the original (Perl) object, but a clone. Since I
>stash the entire main window into a has key on the main app, I was
>concerned about accidentally cloning half the universe.

  wxPerl does not deep-clone data, it creates a new reference
to the existing blessed hash (if it can find an existing one) or a new blessed
scalar reference (if it can't).

>I didn't have any equivalent problems when using the main window.
>
>I should note I'm seeing similar cloning problems with the bindings
>for Wx::Window::FindWindow (FindObject?) or something like that.

  Bug reports are (eventually) investigated :-)

>So another shortcut I'd hoped to use had to be skipped in favour of
>using ->GetParent chains, which does return the original Perl objects.

  This does not make any sense... the typemap used for GetParent() is the
same used for FindWindow().  Do you have a test case?

>I didn't want these issues to slow down the new threading code, so I
>just shelved them at the time.

Regards,
Mattia

>On 17 June 2010 10:36, Mattia Barbon <mattia.bar...@libero.it> wrote:
>> Steffen Mueller wrote:
>>> Hi Adam,
>>>
>>> not much time to reply. Not much time to get involved soon. Quick reply.
>>>
>>> Adam Kennedy wrote:
>>>> If anyone wants to investigate some kind of custom Wx loader, it might
>>>> let us save as much as 5-10meg per thread, which would mean a 15-30meg
>>>> memory reduction in Padre overall, and double or triple the thread
>>>> spawn time (which might get the threads fast enough to remove the need
>>>> to pre-spawn a bunch of threads, removing another third of a second
>>>> from the startup time.
>>>>
>>>> It's a job there if anyone would like it.
>>>
>>> Once somebody figured out a general idea how to do that, I'm confident
>>> Mattia would be willing to accept patches or ideas. He's been remarkably
>>> open to my suggestion of splitting out Wx::Event.
>>
>>   The delay-load branch of wxPerl contains a Wx::Threading module that
>> loads the bare minimum required to send an event from a thread to the
>> main loop.  Test script below.
>>
>> Regards,
>> Mattia
>>
>> #!/usr/bin/perl -w
>>
>> use strict;
>> use threads;
>> use threads::shared;
>> use Wx::Threading;
>> # use Wx;
>>
>> my $TEST_DONE_EVENT : shared;
>>
>> sub send_thread_event {
>>     sleep 3;
>>     my $threvent = new Wx::PlThreadEvent( -1, $TEST_DONE_EVENT, 123 );
>>     Wx::PostEvent( Wx::wxTheApp, $threvent );
>> }
>>
>> my $thread;
>>
>> BEGIN {
>>     $TEST_DONE_EVENT = Wx::NewEventType;
>>     $thread = threads->create( \&send_thread_event );
>> }
>>
>> use Wx;
>>
>> my $app = Wx::SimpleApp->new;
>>
>> Wx::Event::EVT_COMMAND( $app, -1, $TEST_DONE_EVENT,
>>                         sub { print "Hi there!\n"; sleep 50 } );
>>
>> $app->MainLoop;
>> _______________________________________________
>> Padre-dev mailing list
>> Padre-dev@perlide.org
>> http://mail.perlide.org/mailman/listinfo/padre-dev
>>
>_______________________________________________
>Padre-dev mailing list
>Padre-dev@perlide.org
>http://mail.perlide.org/mailman/listinfo/padre-dev
>


_______________________________________________
Padre-dev mailing list
Padre-dev@perlide.org
http://mail.perlide.org/mailman/listinfo/padre-dev

Reply via email to