各位好. 小弟正有一個關於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 thread.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*)...
请问各位大侠, linux下thread, 最多可以支持多少啊. 我感觉到了256就不行了. 迫切想知道. 能不能支持1024个, 怎么改啊. 是不是linux没有freeBSD对线程支持好啊
我要调用pthread_barrier_t 相关的函数。发现在头文件中它们用#ifdef __USE_XOPEN2K 包含,我在编译选项中加-D__USE_XOPEN2K还是没用。怎么办呢?谢谢各位了!
linux 下使用多线程进行accpet 在连接上之后使用 recv接收客户端发来的数据 此时如何判断recv是否超时?注:是否可以给每个线程使用 alarm?
[code]
#include thread.h>
#include
今天碰到一师兄在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. 在网上随便搜一...
请问高手们如何在linux下设置thread的并发粒度,在solaris/HP-UX下有 phread_setconcurrency()。但是linux下好象没有呀? 我用gdb调试,只看到实际上是一个thread的!