threads in c++ using classes

Ben Elliston bje at redhat.com
Mon Mar 11 21:20:03 EST 2002


>>>>> "rohan" == rohan mitchell <rohan.mitchell at start.com.au> writes:

  rohan> Is it possible to to use threads (i am using SDL threads), where the
  rohan> function
  rohan> being executed is a function in a class? When i try, i get the error:
  rohan> no matches converting function 'processPlayerInput' to type 'int
  rohan> (*)(void *)'
  rohan> candidates are: int
  rohan> RealityUndefined::ServerUniverse::processPlayerInput(RealityUndefined:
  rohan> :NetworkServerConnection *)

  rohan> I don't get these errors when using plain functions outside of a
  rohan> class(c style).

You need to use static member functions.  If you really want your
functions to operate on objects, then pass this `this' as the argument
to the thread entry function.

Ben




More information about the linux mailing list