我有一个名为send
的函数void send ( mutex *m,
socklen_t addr_size,
sockaddr_storage serverStorage,
double PLP ,
int size_of_file ,
char ** char_file ,
int *total ,
int *next_seq_to_send ,
int *base_seq ,
int client_socket ,
int *window_size ,
vector <packet> *window_buffer ,
vector <bool> *wind_slots )
我想用这个函数创建一个这样的线程
std::thread send_thread (send, &m ,addr_size,
serverStorage, PLP , size_of_file,
char_file , &total,
&next_seq_to_send,
&base_seq, client_socket,
&window_size,&window_buffer,
&wind_slots );
但我收到了错误
no matching function for call to ‘std::thread::thread(<unresolved overloaded function type>, std::mutex*, socklen_t&, sockaddr_storage&, double&, int&, char*&, int*, int*, int*, int&, int*, std::vector<packet>*, std::vector<bool>*)’
rage, PLP , size_of_file , char_file , &total , &next_seq_to_send , &base_seq , client_socket , &window_size , &window_buffer , &wind_slots );
^
任何帮助?
答案 0 :(得分:2)
std::ref
。
std::ref(x)
的所有用途更改为&x
即可获取参数的地址,您应该做得很好。