Error in my_thread_global_end(): 2 threads didn't exit

本文介绍了在Window2003系统下安装LightTPD-1.4.19-1与PHP5.2.5过程中遇到的Error in my_thread_global_end()错误,并提供了解决方案:通过替换libmysql.dll文件来解决因使用mysql_*()函数导致的问题。

 

 

最近装了LightTPD-1.4.19-1+php-5.2.5-Win32,系统是window2003。

 

成功配置后,出现 Error in my_thread_global_end(): 2 threads didn't exit

 

到网上搜索了一下,这里 的解释比较清楚。

 

希望以后这样的问题少一点。

 

Problem:
Error in my_thread_global_end(): 1 threads didn't exit

It seems that php 5.2.3 libmysql.dll does not work as expected, because Apache shows this error in the logs when we use mysql_*() functions

Solution:
I found it here:
http://forums.mysql.com/read.php?10,153077,155121#msg-155121

which is to replace 'libmysql.dll' file in your PHP installation directory (also in winnt/system32 if you copied it there) with the Dll from PHP 5.2.1

You can download the second one from here:
http://www.php.net/get/php-5.2.1-Win32.zip/from/a/mirror

Regards,
Fernando Gabrieli

由于没有提供完整的 `def _python_exit()` 代码,仅根据现有的引用,推测可能与线程退出及程序退出相关。 从引用 [3] 中的代码来看,其功能是创建一个线程,在线程中等待 5 秒后尝试使用 `sys.exit()` 退出线程,主线程等待子线程结束后也尝试使用 `sys.exit()` 退出。`sys.exit()` 会引发一个 `SystemExit` 异常,如果这个异常没有被捕获,程序会终止。 ```python import sys, time from threading import Thread def testexit(): time.sleep(5) sys.exit() print "post thread exit" t = Thread(target = testexit) t.start() t.join() print "pre main exit, post thread exit" sys.exit() print "post main exit" ``` 这段代码的用途可能是模拟一个多线程程序中,子线程在完成特定任务(这里是等待 5 秒)后退出,主线程在子线程完成后也退出。不过需要注意的是,在 Python 中,`sys.exit()` 在子线程中调用时,只会让当前线程退出,而不会导致整个程序退出。 对于优化方面,可以考虑添加异常处理机制,确保代码的健壮性。同时,在 Python 3 中,`print` 语句需要改为函数形式。以下是优化后的代码: ```python import sys import time from threading import Thread def testexit(): try: time.sleep(5) sys.exit() except SystemExit: pass print("post thread exit") t = Thread(target=testexit) t.start() t.join() print("pre main exit, post thread exit") try: sys.exit() except SystemExit: pass print("post main exit") ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值