Thomas Hruska wrote: > mikejd42 wrote: >> Question to the cosmos: >> With the limited number of arguments (1) that you can pass in to a >> pthread, I would like to pose the question on how other programmers >> get around this limitation. Most of the time I need several pointers >> or variables to be passed into the new thread and have created arrays, >> structures, unions and strings to pass multiple bits of information >> into a thread. >> >> Looking for best practices, what do you all do with this limitation. >> >> Thanks >> <Mike: A thread of the cosmos> > > Derived class from a base class. That's the easiest way to do the > master/worker thread model (the most common model). The base class > manages the OS interface and just passes the 'this' pointer to the new > thread, which then calls a function with the 'virtual' keyword that is > in the derived class. You can store as much data in the thread as you > want. Very clean approach to multithreading, IMO. Way better than > constantly having to build out new multithreading code.
So much for proofreading, "You can store as much data in the derived class as you want." -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleSoft.com/MyTaskFocus/
