ZFFramework
Loading...
Searching...
No Matches
ZFPInterface_ZFThread Class Referenceabstract

protocol for ZFThread More...

#include <ZFProtocolZFThread.h>

Inheritance diagram for ZFPInterface_ZFThread:
ZFProtocol

Public Member Functions

virtual const zfcharprotocolName (void) const
 get the name of the protocol module, e.g. "ZFObject"
virtual void * nativeThreadRegister (ZFThread *ownerZFThread)=0
 see ZFThread::nativeThreadUnregister
virtual void nativeThreadUnregister (void *token)=0
 see ZFThread::nativeThreadUnregister, nativeThreadRegister
virtual ZFThreadthreadForToken (void *token)=0
 get thread from token created by nativeThreadRegister
virtual ZFThreadmainThread (void)=0
 see ZFThread::mainThread
virtual ZFThreadcurrentThread (void)=0
 see ZFThread::currentThread
virtual void * sleepTokenCreate (void)
 see ZFThread::sleep
virtual void sleepTokenDestroy (void *sleepToken)
 see ZFThread::sleep
virtual zfbool sleep (void *sleepToken, zftimet miliSecs)
 see ZFThread::sleep
virtual void sleepCancel (void *sleepToken)
 see ZFThread::sleep
virtual zfbool executeInMainThreadAvailable (void)
 whether executeInMainThread available
virtual void * executeInMainThread (const ZFListener &runnable)=0
 run the runnable in main thread
virtual void executeInMainThreadCleanup (void *nativeToken, zfbool needCancel)=0
 used to cleanup nativeToken
virtual void * executeInNewThread (const ZFListener &runnable, const ZFListener &runnableCleanup)=0
 run the runnable in new thread
virtual void executeInNewThreadCleanup (void *nativeToken)=0
 used to cleanup nativeToken
Public Member Functions inherited from ZFProtocol
virtual void protocolOnInit (void)
 called to init the protocol
virtual void protocolOnInitFinish (void)
 see protocolOnInit
virtual void protocolOnDeallocPrepare (void)
 see protocolOnInit
virtual void protocolOnDealloc (void)
 see protocolOnInit
virtual ZFProtocolInstanceState protocolInstanceState (void)
 protocol instance's state
virtual const zfcharprotocolImplName (void) const
 get the name of the protocol implementation, e.g. "ZFObject_default"
virtual ZFProtocolLevel protocolImplLevel (void) const
 get the level of the protocol implementation
virtual const zfcharprotocolImplPlatformHint (void) const
 get type hint of the implementation or empty string if not defined, e.g. "iOS:NSString" for iOS's string impl, use ZFPROTOCOL_IMPLEMENTATION_PLATFORM_HINT to register
virtual void objectInfoT (zfstring &ret) const
 see objectInfo
virtual zfstring objectInfo (void) const
 get a short info about this object

Protected Types

typedef ZFProtocol zfsuper
 class ref to super
typedef ZFPInterface_ZFThread zfself
 class ref to self

Detailed Description

protocol for ZFThread

Member Function Documentation

◆ protocolName()

virtual const zfchar * ZFPInterface_ZFThread::protocolName ( void ) const
inlinevirtual

get the name of the protocol module, e.g. "ZFObject"

Reimplemented from ZFProtocol.

◆ nativeThreadRegister()

virtual void * ZFPInterface_ZFThread::nativeThreadRegister ( ZFThread * ownerZFThread)
pure virtual

see ZFThread::nativeThreadUnregister

you should not retain or release ownerZFThread

◆ nativeThreadUnregister()

virtual void ZFPInterface_ZFThread::nativeThreadUnregister ( void * token)
pure virtual

see ZFThread::nativeThreadUnregister, nativeThreadRegister

you should not retain or release ownerZFThread

◆ executeInMainThread()

virtual void * ZFPInterface_ZFThread::executeInMainThread ( const ZFListener & runnable)
pure virtual

run the runnable in main thread

you should queue it to run even if current thread is main thread

◆ executeInNewThread()

virtual void * ZFPInterface_ZFThread::executeInNewThread ( const ZFListener & runnable,
const ZFListener & runnableCleanup )
pure virtual

run the runnable in new thread

you must:

  1. call the runnable in new thread (can be canceled by executeInNewThreadCleanup, so the runnable may not run at this case)
  2. cleanup native state if necessary
  3. call the runnableCleanup, even if runnable is canceled

NOTE: the created thread may be blocked by semaphore to achieve app level thread pool logic


The documentation for this class was generated from the following file: