Hello, i want to use c++ in my iphone app (it's my main language & i can port code on other systems)
So i started a C++ class, with an NSThread as member.
Added some functions :
void WaitFoThreadToFinish();
void StartThread();
void StopThread();
static void ThreadProc(void* pOwner);
the first point is my function StartThread(), wich is implemented like this:
actually i pass nil as initWithTarget, i should use "this", but i get compiler error. if i set "self" i get compiler error... (not declared in this scope)
As i am e newbee with OBC, can someone explain me how to do this ?
sorry for my bad english
Thanks.
So i started a C++ class, with an NSThread as member.
Added some functions :
void WaitFoThreadToFinish();
void StartThread();
void StopThread();
static void ThreadProc(void* pOwner);
the first point is my function StartThread(), wich is implemented like this:
Code:
void CSimpleClass::StartThread()
{
if (m_pTimerThread != nil)
{
[m_pTimerThread cancel];
WaitFoThreadToFinish();
}
NSThread *driverThread = [[NSThread alloc] initWithTarget:nil selector:@selector(TimerThredProc:) object:(NSObject*)this];
m_pTimerThread = driverThread;
[driverThread release];
[m_pTimerThread start];
}
actually i pass nil as initWithTarget, i should use "this", but i get compiler error. if i set "self" i get compiler error... (not declared in this scope)
As i am e newbee with OBC, can someone explain me how to do this ?
sorry for my bad english
Thanks.