Visual Studio C++ 2008многопоточность с использованием параметров _beginthreadex
Я использую потоки. Однако у меня есть это предупреждение и не знаю, что я делаю неправильно.
1. unsigned int (__stdcall *)(void *) differs in levels of indirection from 'void *(__stdcall *)(void *)'
2. _beginthreadex different types for formal and actual parameters 3
/* Function prototype */
void* WINAPI get_info(void *arg_list)
DWORD thread_hd;
DWORD thread_id;
/* Value to pass to the function */
int th_sock_desc = 0;
/* Create thread */
thread_hd = _beginthreadex(NULL, 0, get_info, (void*) th_sock_desc, 0, &thread_id);
if(thread_hd == 0)
{
/* Failed to create thread */
fprintf(stderr, "[ %s ] [ %s ] [ %d ]\n", strerror(errno), __func__, __LINE__);
return 1;
}
(void *) th_sock_desc -> & th_sock_desc? –
Опасайтесь, что вы должны вызвать CloseHandle() для возвращаемого значения. boost :: thread может быть лучшей мышеловкой здесь. –