Simple pthread! C++

前端 未结 6 1081
生来不讨喜
生来不讨喜 2021-02-07 02:25

I have no idea why this doesn\'t work

#include 
#include 
using namespace std;

void *print_message(){

    cout << \"Thre         


        
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-07 03:03

    From the pthread function prototype:

    int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
        void *(*start_routine)(void*), void *arg);
    

    The function passed to pthread_create must have a prototype of

    void* name(void *arg)
    

提交回复
热议问题