[PerlChina] 又一问题:如何切换用户权限?
Steven Zhu
stevenzyk at gmail.com
Tue Jun 10 23:34:56 PDT 2008
我是用perl的线程启动的system调用的bat文件,终止perl的线程,无法终止bat文件的进程吗?
在08-6-11,truncatei <truncatei at gmail.com> 写道:
>
> 由system调用bat文件启动的进程好像和perl的线程不一样的,不能用这种方法吧
>
> 2008/6/11 Steven Zhu <stevenzyk at gmail.com>:
> >
> 这个是server端的application,程序会有client端发送指令过来,执行bat文件,在执行中再次发送中断指令,停止bat文件的运行,但是目前使用detach中断不了,还是会执行,请帮忙看看
> > # Server Program
> > use threads;
> > use IO::Socket::INET;
> >
> > print ">> Server Program <<\n";
> >
> > # Create a new socket
> > $MySocket=new IO::Socket::INET->new(LocalPort=>1234,Proto=>'udp');
> > my $new_sock = $MySocket->accept();
> >
> > # Keep receiving messages from client
> > while(1)
> > {
> > $MySocket->recv($text,128);
> > if ( $text =~ /stop/ )
> > {
> > open(STOP , "d:\\thread_d");
> > while(<STOP>)
> > {
> > push @child_thread , $_;
> > }
> > close(STOP);
> > $asdf = @child_thread[0];
> > print "thread: $asdf\n";
> > stop();
> > }
> > else
> > {
> > $thread = threads->new(\&start_thread,$MySocket);
> > open(THREAD , ">d:\\thread_d");
> > print THREAD $thread;
> > close(THREAD);
> > }
> > }
> >
> > sub stop{
> > print "thread: $thread\n";
> > $qwer = $thread->detach;
> > print "$qwer\n";
> > }
> >
> > sub start_thread
> > {
> > chdir "F:\\C26_1";
> > system("F:\\C26_1\\C26_remake.bat");
> > }
> >
> >
> >
> _______________________________________________
> China-pm mailing list
> China-pm at pm.org
> http://mail.pm.org/mailman/listinfo/china-pm
--
BR
Steven.zhu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/china-pm/attachments/20080611/acf659eb/attachment.html
More information about the China-pm
mailing list