2008年8月17日

创建一个pthread线程时如何传递参数

摘要: 现在我写的源代码如下: #include #include typedef struct { char test_no1[12]; char test_no2[20]; short test_length; } tsm_info_def; void *SendSM(void *arg) { char No1[12]; char No2[20]; int Length; tsm_info_... 阅读全文

posted @ 2008-08-17 22:14 cy163 阅读(2532) 评论(1) 推荐(0) 编辑

向 pthread 传递多个参数的方法

摘要: 2007年11月20日 星期二 pthread_create 傳遞參數的用法 最近,又開始寫 socket 的程式. 有別於以前用 select 或最早的 heavy-weight 的 fork 方式. 這次改用 pthread 來 handle server 端所收到的 request . 不過, 有一個問題, 如何傳參數給 thread 的 handler man pth... 阅读全文

posted @ 2008-08-17 22:09 cy163 阅读(2231) 评论(0) 推荐(0) 编辑

call pthread_join() or pthread_detach() for every thread

摘要: http://java.icmc.usp.br/resources/books/ibm_pthreads/users-16.htm pthread_detach()--Detach a Thread Syntax #include int pthread_det... 阅读全文

posted @ 2008-08-17 21:38 cy163 阅读(1555) 评论(0) 推荐(0) 编辑

Once a detached thread has terminated, its resources, including the thread ID, may be reused

摘要: pthread_detach() — mark a thread as detached to reclaim its resources when it terminates SYNOPSIS #include int pthread_detach( pthread_t thread ); PARAMETERS thread Thread whose resourc... 阅读全文

posted @ 2008-08-17 21:36 cy163 阅读(343) 评论(0) 推荐(0) 编辑

给线程变量pthread_t *thread动态分配空间

摘要: 线程的创建和使用 线程的创建是用下面的几个函数来实现的. #include int pthread_create(pthread_t *thread,pthread_attr_t *attr, void *(*start_routine)(void *),void *arg)... 阅读全文

posted @ 2008-08-17 21:35 cy163 阅读(4519) 评论(0) 推荐(0) 编辑

同一线程多次创建 的 线程资源释放问题在每个线程的一开始,用pthred_detach(pthread_self())来使自己detach掉

摘要: fxhnkf 关于线程创建个数的问题 我的程序里调用pthread_create创建一个线程,此线程执行完一定任务后由pthread_exit(NULL);退出 主程序不断的创建此thread 发现到了第500多次创建时,pthread_create返回11,我查了一下errno.h,11是"No more processes" 这是为什么呢???? fxhnkf 关于线程创建个数的问题 ... 阅读全文

posted @ 2008-08-17 21:33 cy163 阅读(4302) 评论(0) 推荐(0) 编辑

导航