可能重複:
Multiple arguments to function called by pthread_create()?
How to pass more than one value as an argument to a thread in C?傳遞多個參數,以在pthread_create
我有這些結構:
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
?不管每個結構領域的意義如何。
我已經看到了,但我的疑問是關於三種不同結構的malloc的... – rschirin
的可能重複[多參數功能通過在pthread_create()調用?(http://stackoverflow.com /(問題/ 1352749 /),[pthreads和C++](http://stackoverflow.com/questions/2468113/),[將多個參數傳遞給C(pthread_create)中的一個線程](http://stackoverflow.com/questions/6524433 /) – outis