Thread create(...) problem

Login to reply to this topic.
Mon, 2007-04-02 08:55
Joined: 2007-04-02
Forum posts: 4
Hello to all,

1. I'm trying for a few hours/days to solve this problem so every advice would be welcome, not to saying solution   Smiley

So this is how it goes:

TThreadFunction threadFunction = ThreadPrivateActions::aFunction((TAny *)this);
const TInt KMinHeapSize = 0x1000;
const TInt KMaxHeapSize = 0x1000000;
RThread().Create(name, threadFunction, KDefaultStackSize, KMinHeapSize, KMaxHeapSize, (void*) this);

Class 'ThreadPrivateActions' just contains a method with following "signature": static TInt aFunction(TAny *data) {...blah blah...}

I get the compiler error:
illegal implicit conversion from 'int' to 'int (*)(void *)'

which is true, obiovilusly, but I don't know how to solve this, what to do....


2. BTW, is it secure to put that range for heap and deafult stack size for stack?

Thanx!


Mon, 2007-04-02 14:19
Joined: 2006-10-07
Forum posts: 131
Re: Thread create(...) problem
1. Use a function name directly (though you can pass directly to the RThread::Create).
Code:
TThreadFunction threadFunction = aFunction;

2. I would just do the following:
Code:
RThread::Create( name, aFunction, KDefaultStackSize, NULL, this );
Otherwise new thread's heap will be separate from old thread's heap (can't share data).
  • Login to reply to this topic.