【发布时间】:2012-01-23 18:07:31
【问题描述】:
可能重复:
Multiple arguments to function called by pthread_create()?
How to pass more than one value as an argument to a thread in C?
我有这些结构:
struct Request {
char buf[MAXLENREQ];
char inf[MAXLENREQ]; /* buffer per richiesta INF */
int lenreq;
uint16_t port; /* porta server */
struct in_addr serveraddr; /* ip server sockaddr_in */
char path[MAXLENPATH];
/*struct Range range;*/
};
struct RequestGet {
char buf[MAXLENREQ];
int maxconnect;
struct Range range;
};
struct ResponseGet{
char buf[MAXLENDATA];
//int LenRange;
int expire;
char dati[MAXLENDATA];
struct Range range;
};
如何将它们传递给pthread_create?不管结构的每个字段的含义。
pthread_create(&id,NULL,thread_func,????HERE????);
【问题讨论】:
-
我看过,但我怀疑的是三种不同结构的malloc...
标签: c multithreading parameters pthreads