首页| JavaScript| HTML/CSS| Matlab| PHP| Python| Java| C/C++/VC++| C#| ASP| 其他|
购买积分 购买会员 激活码充值

您现在的位置是:虫虫源码 > 其他 > threadeventbus

threadeventbus

  • 资源大小:3.54 kB
  • 上传时间:2021-06-30
  • 下载次数:0次
  • 浏览次数:1次
  • 资源积分:1积分
  • 标      签: perl event Threads Threading bus thread

资 源 简 介

Extend your threaded Perl objects with this event-bus which brokers requests via autoloader calls. This is an easy way of exposing a Perl object to thread calls via autoloader & opportunistic shared cloning and serialisation of parameters/return values. It takes some of the pain of Perl threading away. Example use: ``` #!/usr/bin/perl package WorkerThread; use threads; use threads::shared; use Thread::EventBus; sub new { my $class = shift; my $id = shift; my $self = {}; bless $self, $class; $self->{ "eb" } = Thread::EventBus->new( $self, "worker#" . $id ); $self->{ "eb" }->set_procedure( "method1", &method1 ); $self->{ "eb" }->set_method( "method2", &method2 ); $self->{ "id" } = $id; $self->thread_start; return $self; } sub thread_start { my $self = shift; threads->create( &threadloop, $self ); return; }

文 件 列 表

eventbus-0.9
test.pl
Thread

相 关 资 源

您 可 能 感 兴 趣 的

同 类 别 推 荐

VIP VIP
0.178078s