Let's say I have a thread:
假设我有一个主题:
sub new {
my $class = shift;
my $self = ref $class || $class;
bless { 'read_set' => IO::Select->new,
'write_set' => IO::Select->new,
'error_set' => IO::Select->new }, $self;
}
sub start {
my $self = shift;
$self->{'thread'} = threads->create(\&worker_thr, $self);
$self->{'thread'}->detach;
}
sub worker_thr {
my $self = shift;
while(1) {
my($read_active, $write_active, $error_active) =
IO::Select->select(
$self->{'read_set'},
$self->{'write_set'},
$self->{'error_set'},
undef
);
}
}
sub