ZFFramework
 
Loading...
Searching...
No Matches
ZFProtocolZFThread.h File Reference

protocol for ZFThread More...

#include "ZFCore/ZFProtocol.h"
#include "ZFCore/ZFThread.h"

Go to the source code of this file.

Classes

class  ZFPInterface_ZFThread
 protocol for ZFThread More...
 
class  ZFThreadMainThread
 see ZFThread More...
 

Typedefs

typedef void *(* ZFMainThreadTaskImplCallbackExecute) (const ZFListener &runnable)
 see ZFMainThreadTaskImplSet
 
typedef void(* ZFMainThreadTaskImplCallbackCleanup) (void *nativeToken)
 see ZFMainThreadTaskImplSet
 

Functions

void ZFMainThreadTaskImplSet (ZFMainThreadTaskImplCallbackExecute executeImpl, ZFMainThreadTaskImplCallbackCleanup cleanupImpl=zft_zfnull)
 set custom impl for ZFThread::taskQueueAdd for main thread
 
ZFMainThreadTaskImplCallbackExecute ZFMainThreadTaskImplGetExecute (void)
 see ZFMainThreadTaskImplSet
 
ZFMainThreadTaskImplCallbackCleanup ZFMainThreadTaskImplGetCleanup (void)
 see ZFMainThreadTaskImplSet
 

Detailed Description

protocol for ZFThread

Function Documentation

◆ ZFMainThreadTaskImplSet()

void ZFMainThreadTaskImplSet ( ZFMainThreadTaskImplCallbackExecute executeImpl,
ZFMainThreadTaskImplCallbackCleanup cleanupImpl = zft_zfnull )
extern

set custom impl for ZFThread::taskQueueAdd for main thread

main thread is a special case for thread task management, in ZFFramework, there are mainly two way of main thread task management:

  • most platforms (Android, iOS, etc) has builtin event loop logic which can not be touched by ZFFramework, but supplies task post API, ZFFramework would use the platform specified API to achieve main thread task queue logic
  • some platforms (SDL for example) let app to supply event loop, which requires app to manually implement the main thread task queue logic, at this case, ZFFramework allow impl to specify custom impl to resolve main thread task, by using this method, app can embed default thread impl to the customized main event loop

whether the custom impl would be used, depends on the ZFThread protocol impl