About Store Forum Documentation Contact



Post Reply 
Class Threading
Author Message
Dynad Offline
Member

Post: #1
Class Threading
Hey,

Is there a possibility to use the threading on classes as well? Now your are limited to single functions. But i want to create a object from a class and for that new created object you create a new thread.

Something like this:
PHP Code:
class SInstanceRunnable : public ZThread::Runnable
{
public:
    
SInstanceRunnable();
    
void run(void);
    
void sleep(U32);
    
inline SInstance *GetInstance(void) { return _i; }

private:
    
SInstance *_i;
};

SInstanceRunnable *r=new SInstanceRunnable();
        
ZThread::Thread t(r);
        
instanceList.push_back(r);
        
t.setPriority((ZThread::Priority)2); 


Thnx,
~Dynad

There is always evil somewhere, you just have to look for it properly.
10-06-2010 02:55 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: Class Threading
Bool threadfunc(Thread &t)
{
Object &obj=*(Object*)t.user;
obj.
}

if you mean something else then I don't know
10-06-2010 08:58 AM
Find all posts by this user Quote this message in a reply
Dynad Offline
Member

Post: #3
RE: Class Threading
Ofcourse.. i guess this is exactly what i need Thnx! smile

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