Perl线程问题 [英] Perl threads question

查看:72
本文介绍了Perl线程问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我遇到了线程问题。

i希望发送带有线程的tcp数据包,我还想选择执行该操作的线程数以及何时线程发送数据包我希望它能告诉我。



i只需输入数据包:

Hello, I have had this problem with threads.
i want to send a tcp packet with threads and i also want to select the amount of threads to do that and when ever a thread sends a packet i want it to tell me that.

i send the packet with simply with:

$socket->send($data);





所以只是在线程中,也许我需要定义一些会发送它的东西



我尝试了什么:



这是我在某网站上发现的信达工作:





so just that in threads, maybe i need to define something that will send it

What I have tried:

this is something i found on some website that cinda works:

use threads;
 
use Threads::shared;
 
sub start_thread {
        my @args = @_;
        $socket->send($data);
}

my $thr = threads->create('start_thread', 'argument');

$thr->join();

$thr->detach();







或类似的东西。但这并没有告诉我它永远不会持续




or something like that. but that dose not tell me and it dont contiue for ever

推荐答案

socket - > send(
socket->send(


数据);
data);





所以只是在线程中,也许我需要定义将发送它的东西



我尝试过:



这是我在某个网站上发现的信达工作:





so just that in threads, maybe i need to define something that will send it

What I have tried:

this is something i found on some website that cinda works:

use threads;
 
use Threads::shared;
 
sub start_thread {
        my @args = @_;
        


socket - > send(
socket->send(


这篇关于Perl线程问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆