ChinaUnix.net
相关文章推荐:

linux thread

各位好. 小弟正有一個關於thread的問題想請教各位. 小弟的程序內會調用到mysql的, 所以我想所有和mysql有關系的都用一個thread來完成. 我想這樣效率應該會快一些. 但有一個問題來了. 我想在thread中返回一個值來告知這個thread內的步驟能否完成, 並不是thread能否啟動的返回值... 例如: [code] { ....... thread_t mythread; /* 初始化一個thread */ char sql[] = "insert xxxxxxxx"; if(pthread_create(&mythread, NULL, ...

by 惠繪洋 - C/C++ - 2006-11-22 10:18:36 阅读(2913) 回复(16)

相关讨论

my programe follows: #ifdef HAVE_CONFIG_H #include ; #endif #include; #include; #include ; #include ; #includethread.h>; pthread_cond_t wakeup=Pthread_COND_INITIALIZER; pthread_mutex_t lock= Pthread_MUTEX_INITIALIZER; void hello(void*ptr) { perror("hello thread1"); exit(0); } main() { pthread_t tid; pthread_create(&tid,NULL,(void*)...

by lrh_0_2000 - C/C++ - 2005-09-08 21:22:17 阅读(864) 回复(3)

请问各位大侠, linuxthread, 最多可以支持多少啊. 我感觉到了256就不行了. 迫切想知道. 能不能支持1024个, 怎么改啊. 是不是linux没有freeBSD对线程支持好啊

by ybzhg - 内核/嵌入技术 - 2004-11-13 10:00:49 阅读(808) 回复(5)

how to safety shutdown a thread in linux? hope a example...thanx

by eflyer - C/C++ - 2004-07-15 13:52:08 阅读(778) 回复(1)

我要调用pthread_barrier_t 相关的函数。发现在头文件中它们用#ifdef __USE_XOPEN2K 包含,我在编译选项中加-D__USE_XOPEN2K还是没用。怎么办呢?谢谢各位了!

by guangguang - C/C++ - 2004-09-30 13:56:21 阅读(1270) 回复(4)

linux 下使用多线程进行accpet 在连接上之后使用 recv接收客户端发来的数据 此时如何判断recv是否超时?注:是否可以给每个线程使用 alarm?

by shineyear - C/C++ - 2006-09-26 20:25:56 阅读(2619) 回复(4)

[code] #include #include thread.h> #include #include using namespace std; int number = 1; void* thread1(void*) { for(int i = 0; i < 10; i++) { cout << "this is thread1, number is " << number++; cout << " pid is " << getpid() << " id is " << pthread_self() << endl; } } void* thread2(void*) { for(int i = 0; i < 10; i++) { cout << "this i...

by clyman - C/C++ - 2006-11-16 09:27:40 阅读(3886) 回复(14)

1.在gnu/linux上还有传统的thread实现吗? 2.这样做有何利弊? Thanks in advance.

by shahand - C/C++ - 2009-07-22 11:13:06 阅读(2008) 回复(6)

今天碰到一师兄在FC6系统中从源码安装MySql时遇到问题: #./configure --prefix=/usr/local/mysql … … checking "linuxthreads"... "Not found" configure: error: This is a linux system and linuxthreads was not found. On linux linuxthreads should be used. Please install linuxthreads (or a new glibc) and try again. See the Installation chapter in the Reference Manual for more information. 在网上随便搜一...

by williamyoung - MySQL文档中心 - 2007-03-20 22:44:47 阅读(1249) 回复(0)
by jato - 内核/嵌入技术 - 2005-05-10 04:39:40 阅读(2046) 回复(17)

请问高手们如何在linux下设置thread的并发粒度,在solaris/HP-UX下有 phread_setconcurrency()。但是linux下好象没有呀? 我用gdb调试,只看到实际上是一个thread的!

by victorxu79 - 内核/嵌入技术 - 2003-03-18 09:55:37 阅读(765) 回复(0)