create thread - passing arguments

前端 未结 3 999
清歌不尽
清歌不尽 2021-02-05 14:32

I am attempting on creating multiple threads that each thread calculates a prime. I am trying to pass a second argument to a function using thread create. It keeps throwing up e

3条回答
  •  死守一世寂寞
    2021-02-05 15:19

    This is the code of Manakarse , everything is really good but you need a

    pthread_join(thread[i],NULL)

    just to be sure all of threads will successfully execute before end of main thread("main will "waiting" while all of threads aren't finished yet) ;

提交回复
热议问题