About Store Forum Documentation Contact



Post Reply 
class function pointer problem.
Author Message
Dynad Offline
Member

Post: #1
class function pointer problem.
Hey,

I got a compile problem when i try to use the Thread funcs in my structs/classes.

Second about thread pools. I want to make a list of threads and run them. But im not sure if the function: MultiThreadedCall does this for you. If so can u give me more information about how to use it?

PHP Code:
error C3867'classRS::ThreadS': function call missing argument list; use '&classRS::ThreadS' to create a pointer to member 

Code snippet:
PHP Code:
class classRS
{
    
Bool ThreadS(Thread &threadCaller);
    
    
Thread s;
}


Bool classRS::ThreadS(Thread &threadCaller)
{
    
RSS &obj=*(RSS*)s.user;
    
obj.Update();

    return 
false;
}

void classRS::Main()
{
_s = new RSS();
    
s->create(ThreadS200_s);


I get the compile error on line: s->create(ThreadS, 2, 0, 0, _s);


Thnx,

~Dynad

There is always evil somewhere, you just have to look for it properly.
(This post was last modified: 10-17-2010 04:33 PM by Dynad.)
10-17-2010 02:23 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #2
RE: class function pointer problem.
if you declare function inside class, then you need to make it static
class
{
static Bool ThreadS(...) // <-add static
}


MultiThreadedCall executes a given function for specified amount of times, this is used for processing purposes (you have a function that processes data which you need to execute 100 times), so most efficient on a quad core machine, is execute it 25 times on each of 4 cores simultaneously. that's what MultiThreadedCall does.
10-17-2010 12:10 PM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #3
RE: class function pointer problem.
- Yea adding static fixed the problem, thx

- Ok that makes more sense now... its very handy for preprocessing data smile

There is always evil somewhere, you just have to look for it properly.
10-17-2010 10:57 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply