加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

perl信号INT的问题

发布时间:2020-12-16 06:16:32 所属栏目:大数据 来源:网络整理
导读:我在 windows activestate perl 5.8上有以下perl代码 $SIG{INT}=clean; ... sub clean { print 'cleaning...'; ... ... exit 0; } 但是当我尝试通过Ctrl ^ c关闭我的程序时它根本没有进入子清洁可能有人帮助我为什么会错过什么? 解决方法 似乎Windows不像U
我在 windows activestate perl 5.8上有以下perl代码

$SIG{INT}=&;clean;

  ...
  sub clean {

  print 'cleaning...';
  ...
  ...
  exit 0;

  }

但是当我尝试通过Ctrl ^ c关闭我的程序时它根本没有进入子清洁可能有人帮助我为什么会错过什么?

解决方法

似乎Windows不像Unix那样提供信号.

来自man perlwin32:

Signal handling may not behave as on Unix platforms (where it doesn’t exactly “behave”,either :). For instance,calling “die()” or “exit()” from signal handlers will cause an exception,since most implementations of “signal()” on Win32 are severely crippled. Thus,signals may work only for simple things like setting a flag variable in the handler. Using signals under this port should currently be considered unsupported.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读