line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Wx::Perl::Thread::Object; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2215
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
89
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
496
|
use Thread::Queue::Any::Monitored; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
my $SELF; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub create { |
11
|
|
|
|
|
|
|
my( $class, @args ) = @_; |
12
|
|
|
|
|
|
|
my( $q, $t ) = Thread::Queue::Any::Monitored->new |
13
|
|
|
|
|
|
|
( { monitor => sub { my( $meth, @args ) = @_; $SELF->$meth( @args ) }, |
14
|
|
|
|
|
|
|
pre => sub { $SELF = shift->new( @_ ) }, |
15
|
|
|
|
|
|
|
}, $class, @args ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Oops, avoid the proxy being cloned |
18
|
|
|
|
|
|
|
my $self = bless {}, 'Wx::Perl::Thread::Object::Proxy'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$self->{q} = $q; |
21
|
|
|
|
|
|
|
$self->{t} = $t; |
22
|
|
|
|
|
|
|
$self->{class} = $class; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
return $self; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
package Wx::Perl::Thread::Object::Proxy; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use strict; |
30
|
|
|
|
|
|
|
use warnings; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub isa { $_[0]->{class}->isa( $_[1] ) } |
33
|
|
|
|
|
|
|
sub can { $_[0]->{class}->can( $_[1] ) } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $AUTOLOAD; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub AUTOLOAD { |
38
|
|
|
|
|
|
|
my $name = $AUTOLOAD; |
39
|
|
|
|
|
|
|
$name =~ s/^.*:://; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return if $name eq 'DESTROY'; |
42
|
|
|
|
|
|
|
die $AUTOLOAD if Thread::Queue::Any::Monitored->self; |
43
|
|
|
|
|
|
|
die $AUTOLOAD if $name eq 'new'; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my $self = shift; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
$self->{q}->enqueue( $name, @_ ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub wpto_terminate { $_[0]->{q}->enqueue( undef ) } |
51
|
|
|
|
|
|
|
sub wpto_join { $_[0]->{t}->join } |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |