ChinaUnix.net
相关文章推荐:

linux thread cpu

各位好. 小弟正有一個關於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 阅读(865) 回复(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 阅读(780) 回复(1)

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

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

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

by shineyear - C/C++ - 2006-09-26 20:25:56 阅读(2621) 回复(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 阅读(3890) 回复(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 阅读(1251) 回复(0)

在一个process里生成线程,并把生成的线程加入thread pool, 问题是, 所生成的线程都属于当前process, 而一个process是应该只能在一个cpu上执行 (好象不能把一个process分别同时在2个cpu上执行) 因此,上面生成的thread pool里的线程,好象不能充分利用多个cpu的硬件么,如何使得thread pool里的线程能在不同cpu上运行? 从cpu affinity方面着手? 请有这方面经验的朋友指教,谢谢

by kalashnikova_ak - C/C++ - 2009-07-29 16:33:51 阅读(1734) 回复(8)
by zhizhi - Informix - 2007-12-05 11:22:23 阅读(2811) 回复(5)