InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IIdleTaskThread Class Referenceabstract

#include <IIdleTaskThread.h>

Inheritance diagram for IIdleTaskThread:
IIdleTaskIPMUnknownCIdleTaskThread

Public Types

enum  { kDefaultIID = IID_IIDLETASKTHREAD }
 
typedef boost::function< void()> Task
 
- Public Types inherited from IIdleTask
enum  { kDefaultIID = IID_IIDLETASK }
 
enum  { kEndOfTime = ~(uint32)0, kOnFlagChange = ~(uint32)1, kNextEventCycle = ~(uint32)2 }
 
enum  { kMaxTaskNameLength = 1023 }
 

Public Member Functions

virtual uint32 YieldToEventLoop (uint32 millisecSleep=0)=0
 
virtual void ExecuteTaskInMainThread (Task &task)=0
 
- Public Member Functions inherited from IIdleTask
virtual uint32 RunTask (uint32 appFlags, IdleTimer *timeCheck)=0
 
virtual void InstallTask (uint32 millisecsBeforeFirstRun)=0
 
virtual void UninstallTask ()=0
 
virtual const char * TaskName ()=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

An implementation of IIdleTask that uses cooperative threads to perform its task. You would use this if your idle task might take a long time to execute and you want to be able to yield back to the event loop without "losing your place", (i.e., you keep track of how far along your task is by using the stack and the program counter).

Member Typedef Documentation

typedef boost::function<void ()> IIdleTaskThread::Task

Generic task definition.

Member Function Documentation

virtual void IIdleTaskThread::ExecuteTaskInMainThread (Tasktask)
pure virtual

INTERNAL USE ONLY! Should be used only by the architecture team! Invokes the specified task in the main application thread. If the call is happening in another thread, this IdleTaskThread will switch to the main thread, execute the task and come right back. If the context is already the main thread, the task will simply be executed. It will NOT go through the event loop. This is useful when a component is really tied to the main execution thread (like UI) and it needs to be executed only in that context.

Implemented in CIdleTaskThread.

virtual uint32 IIdleTaskThread::YieldToEventLoop (uint32 millisecSleep = 0)
pure virtual

Causes this thread to yield itself to the event loop rather than allowing it to hog all of the processor time

Parameters
millisecSleep- The number of milliseconds this thread should sleep before reawakening.
Returns
- The current App Flags will get returned to the client.

Implemented in CIdleTaskThread.