Error with passing a pointer using threads

后端 未结 1 1043
灰色年华
灰色年华 2020-12-20 09:10

Updated code: 3/7/11 : 9:29pm

using namespace std;

void * matrixACreate(void * param);  
void *status;

struct a  
{  
     int Arow; // Matrix A    
     i         


        
相关标签:
1条回答
  • 2020-12-20 10:09
    struct a * a = (struct a *) malloc(sizeof(struct a)); 
    // init a's members
    error = pthread_create(&matrixAthread, NULL, matrixACreate, a);
    

    EDIT: In response to updated question:

    void * matrixACreate(void * param) {  
        struct a * matrix = (struct a *) param;  
        int range = ((matrix->high - matrix->low) + 1);  
        cout << matrix->Arow << endl;  
        return NULL;
    }  
    
    0 讨论(0)
提交回复
热议问题