[SDL] C++ and SDL_Thread
Ryan C. Gordon
icculus at icculus.org
Wed Jan 31 00:58:07 PST 2007
> I would like to create a class which, when instantiated, owns a
> thread calling one of its member functions. Thus, I have this class
> (I've cut some parts that aren't important to save space, but they
> all work as intended, I'm just adding the threading to hopefully
> speed things up a smidgeon):
Expect 17 replies saying this, but...
int thread_func( void *unused );
Needs to be
static int thread_func( void *unused );
Otherwise there's a hidden parameter in C++. In terms of C, the first
one is more like:
int thread_func(VE_Media *this, void *unused);
...which obviously isn't what you want.
Your UpdateHelper() approach in the second email you sent is actually
The Right Thing to do.
--ryan.
More information about the SDL
mailing list