ZFFramework
 
Loading...
Searching...
No Matches
ZFThreadPool.h
Go to the documentation of this file.
1
5
6#ifndef _ZFI_ZFThreadPool_h_
7#define _ZFI_ZFThreadPool_h_
8
9#include "ZFThread.h"
11
12// ============================================================
13zfclassFwd _ZFP_ZFThreadPoolPrivate;
18zfclass ZFLIB_ZFCore ZFThreadPool : zfextend ZFObject {
19 ZFOBJECT_DECLARE(ZFThreadPool, ZFObject)
20 ZFOBJECT_SINGLETON_DECLARE_DETAIL(private, public, ZFThreadPool, instance)
21
24
27 , ZFMP_IN(const ZFListener &, callback)
28 , ZFMP_IN(const ZFListener &, finishCallback)
29 )
30
35
36protected:
38 virtual zfstring threadPoolName(void) {
39 return zfstr("%s:%s", this->classData()->className(), (const void *)this);
40 }
41
42protected:
44 virtual void objectOnInit(void);
46 virtual void objectOnDeallocPrepare(void);
47
48private:
49 _ZFP_ZFThreadPoolPrivate *d;
50};
51
53#endif // #ifndef _ZFI_ZFThreadPool_h_
54
#define ZFLIB_ZFCore
used to export symbols
Definition ZFCoreEnvDef.h:30
#define zfextend
dummy macro shows class inherit from another
Definition ZFCoreTypeDef_ClassType.h:53
#define zfoverride
dummy macro shows that method override parent's method
Definition ZFCoreTypeDef_ClassType.h:58
#define zfclassFwd
forward declaration of a class type
Definition ZFCoreTypeDef_ClassType.h:31
_ZFT_t_zfuint zfuint
same as unsigned int, see zfindex
Definition ZFCoreTypeDef_CoreType.h:169
zft_zfstring< zfchar > zfstring
see zft_zfstring
Definition ZFCoreTypeDef_StringType.h:15
#define ZFMP_IN(ParamType, paramName)
macro to wrap param types for ZFMETHOD_INLINE_0 series
Definition ZFMethod.h:105
#define ZFMETHOD_DECLARE_0(ReturnType, MethodName)
see ZFMethod
Definition ZFMethodDeclare.h:693
#define ZFMETHOD_DECLARE_2(ReturnType, MethodName, ZFMP_0, ZFMP_1)
see ZFMethod
Definition ZFMethodDeclare.h:1025
#define ZF_NAMESPACE_GLOBAL_BEGIN
begin namespace ZFFramework
Definition ZFNamespace.h:97
#define ZF_NAMESPACE_GLOBAL_END
end namespace ZFFramework
Definition ZFNamespace.h:98
#define zfclass
same as class, shows that this class is a ZFObject type
Definition ZFObjectClassTypeFwd.h:38
#define ZFOBJECT_DECLARE(ChildClass, SuperClass,...)
necessary for every class inherit from ZFObject
Definition ZFObjectDeclare.h:126
#define ZFOBJECT_SINGLETON_DECLARE_DETAIL(SetterAccessType, GetterAccessType, AccessTypeName, accessMethodName)
see ZFOBJECT_SINGLETON_DECLARE
Definition ZFObjectGlobalInstance.h:261
#define ZFPROPERTY_ASSIGN(Type, Name,...)
see ZFPROPERTY_RETAIN
Definition ZFPropertyDeclare.h:128
thread utility
listener as ZFCallback, mostly used by ZFObject::observerNotify
Definition ZFObjectObserver.h:30
abstract task id
Definition ZFTaskId.h:16
static ZFThreadPool * instance()
virtual void objectOnDeallocPrepare(void)
called before objectOnDealloc, safe to call virtual functions here
virtual void objectOnInit(void)
override this to init your object
virtual zfstring threadPoolName(void)
auto update ZFThread::threadName
Definition ZFThreadPool.h:38
virtual zfautoT< ZFTaskId > start(const ZFListener &callback, const ZFListener &finishCallback)
see zfasync
virtual void removeAll()
cancel all task, called automatically before dealloc
virtual const ZFClass * classData(void)
get instance's class info
Definition ZFThreadPool.h:19
virtual zfuint & maxThread()
max thread
Definition ZFThreadPool.h:23
type restrict version of zfauto
Definition zfautoFwd.h:110
zfstring zfstr(const zfchar *fmt=zft_zfnull)
string format util
Definition zfstr.h:59