CCThread(On iOS, should create autorelease pool when create a new thread)

来源:互联网 发布:nhj提取软件 编辑:程序博客网 时间:2024/04/28 03:22

#ifndef __CC_PLATFORM_THREAD_H__

#define __CC_PLATFORM_THREAD_H__


#include "CCCommon.h"

#include "CCPlatformMacros.h"


NS_CC_BEGIN


/* On iOS, should create autorelease pool when create a new thread

 * and release it when the thread end.

 */

class CC_DLL CCThread

{

public:

    CCThread() : m_pAutoreasePool(0) {}

    ~CCThread();

{

    [(id)m_pAutoreasePool release];

}


    void createAutoreleasePool();

{

    m_pAutoreasePool = [[NSAutoreleasePool alloc] init];

}


private:

    void *m_pAutoreasePool;

};

NS_CC_END


#endif    


0 0
原创粉丝点击