+ -
当前位置:首页 → 问答吧 → perl问题,不知道是不是线程问题

perl问题,不知道是不是线程问题

时间:2010-11-22

来源:互联网

我在perl脚本中开了新线程,但在执行过程中报错,不知道是什么原因
Thread 1 terminated abnormally: DBD::mysql::db prepare failed: handle 2 is owned by thread 283f04 not current thread 1d9
e2a4 (handles can't be shared between threads and your driver may need a CLONE method added) at C:/Perl/site/lib/Mysql.p
m line 169.
不知道是不是线程的原因?

作者: andy806   发布时间: 2010-11-22

是因为线程,但我现在还不知道是否可以通过共享变量/句柄能否解决。

一般我都是使用fork并发进程来做并行的事务。使用进程扇的形式,父进程负责构造子进程的工作队列,子进程完成实际工作。设计数据库操作的话,会有多个数据库连接。

作者: fibbery   发布时间: 2010-11-22