原帖由 arenxl 于 2007-2-1 16:53 发表
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <strings.h>
#define MAXTHREAD 50
void *GetHlrThr1()
{
char log[10];
...
原帖由 arenxl 于 2007-2-1 16:53 发表
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <strings.h>
#define MAXTHREAD 50
void *GetHlrThr1()
{
char log[10];
...
原帖由 arenxl 于 2007-2-2 22:48 发表
提醒一下,编译以后的程序名不要用test,否则递归调用,很快就会把资源耗尽
不是很明白,望指点一下。
原帖由 arenxl 于 2007-2-1 16:53 发表
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <string.h>
#include <strings.h>
#define MAXTHREAD 50
void *GetHlrThr1()
{
char log[10];
...
原帖由 wuqing 于 2007-2-7 15:18 发表
你 gcc -o test yoursource.c
然后运行 ./test
我在一台 3G RAM, 2 X 3GHz的X346,(OS是Linux)上运行
1分钟不到机器就没有任何响应,连键盘和鼠标都没有反应。
原帖由 arenxl 于 2007-2-8 00:44 发表
兄弟,这个有没有科学依据呢?难道就因为程序命名为test就导致你了说的恶劣后果。 不过我还是以后避免这种命名,宁可信其有。不过,我还是希望兄弟能够深入找一下原因,是不是有其它原因导致了你说的结果?
你的每一个线程里都有system(cmd), 而 cmd中包含 ./test,你说这个程序该如何运行呢?
你可以测试测试啊。
1. 你的程序,至少是你给的那段代码是可以完整地运行的
2. 肯定会导致进程和线程资源用完
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |