The main() function creates a thread that is supposed to live until the user wishes to exit the program. The thread needs to return values to the main functions at periodic intervals. I tried doing something like this, but hasn't worked well -

```
std::queue<std::string> q;

void start_thread(int num)
{
 std::string str;
 //Do some processing
 q.push(str);
}

int main()
{
 //Thread initialization
 int i;
 //Start thread
 pthread_create(&m_thread,NULL,start_thread,static_cast<void *>i);

 while(true)
 {
  if(q.front())
  {
      std::cout<<q.front();
      return 0;
  }
 }

 //Destroy thread.....  
 return 0;
}

```

Any suggestions?