GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


A Paste by jake`
1
 
struct thread_params
{
  //  stuff here
  std::string s;
};


void my_routine_entry (void* p) 
{
  thread_params* my_ptp = static_cast <thread_params*> (p);
  //  do your stuff


  //  free memory .. important!
  delete my_ptp;
}


void f ()
{
  char t[] = "blub";
  std::string s = "blubber";

  // one for each thread
  thread_params* ptp1 = new thread_params; 
  thread_params* ptp2 = new thread_params; 

  ptp1->s = t;  // good idea
  ptp2->s = s;  // also a good idea :)

  _beginthread (my_routine_entry, 0,  ptp1);
  _beginthread (my_routine_entry, 0,  ptp2);
}