我在Windows上使用帶有MinGW的Pthreads。對pthread_create的調用返回一個錯誤,該錯誤轉換爲「空間不足」。它指的是什麼樣的空間?線程堆棧空間?pthread_create沒有足夠的空間
int scannerThreadReturnValue = pthread_create(&parserThreadHandle, &attr, parserThread, (void *)filename);
if(scannerThreadReturnValue != 0) {
printf("Unable to create thread %s\n", strerror(errno));
}
else printf("Parser thread creation successfull\n");
檢查'pthread_create()'參數的第四個參數段落到'parserThread()'必須作爲指針傳遞給struct,你使用的是attr?否則將其設置爲NULL –