title: Read lines of file and assign to threads
body: <p>I have a file and want to read each line and pass it to a thread. However what I have currently written does not work properly,since threads created don't seem to have a different line each,which is kind of buffling. Here is the code</p>
  
  <pre><code>void *threadfunction(void* r){
      char* command;
      command=(char*) r;
      printf("%s\n",command);
  }
  
  //main here
  int count=0;
  while(fgets(line,sizeof(line),file)!=NULL){
          int retval=0;
          retval=pthread_create(&amp;tthread[count],NULL,threadfunction,(void*)line);
          count++;
  }
  </code></pre>
  
  <p>I would expect it reads the line, then send it to newly created thread and repeat. But I guess im wrong.</p>