Steve wrote:
And it works, but it feels very wrong to me. Having to cast the object to void, then recast back to it's original form, seems like a lot of overhead as well as being dangerous. And it has to occur every 250 ms, which seems like alot of recasting to me.
You are right. Using pthreads with C++ classes is awkward. That's just the way it is.
Most people write a thread class with a pure virtual run() method like you've done that you can then sub-class to get a custom thread. This cleans up the code, and isolates the awkward stuff to one place, but the casting is still there. It's called thunking by the way (usage: "I've designed a class to thunk pthreads into a C++ class").
--Dave /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
