C linux pthread needs sleep to work

I'm writing a program in c on linux using gcc. If I'm not using that sleep statement it will print "thread created" 2,3 or 4 number of times randomly. Can anyone explain me this behavior? //the following code is just a sample, i know is not really useful to create a thread just to print a string :) void* makeRequest(void* arg) { printf("Thread created\n"); } int main(){ pthread_t thr[10]; for(i=0; i

以上就是C linux pthread needs sleep to work的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » CSS3 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准