[SDL] SDL_CreateThread

andy preston andy at prestonmedina.com
Tue Jul 16 18:26:00 PDT 2002

On Tue, 2002-07-16 at 17:29, Nick Groesz wrote:

> My particular problem is that I have 4 member functions within my client 
> class to be threaded and 4 member functions in my server class that I 
> want to run in threads.

 The way that you described it is the standard way to get around these
problems. The way I dealt with multiple threads is to simply have a base
class that deals with the SDL_CreateThread function and has the
sprite_callback functionality that you described. The base class has a
pure virtual "run" function that each thread overrides. It would mean
that you have to split your functionality out of one class and into
multiple classes. Normally that is not a problem since sperate threads
should avoid using the same data (variables) as much as possible. You
may also find that your class design makes more sense split out too.


More information about the SDL mailing list