About
The Cinema 4D classic API provides various functions to handle threads and thread related tasks.
- Warning
- For MAXON API threading utilities see Threads Manual.
Utility Functions
Various tasks should only be performed from the main thread. For example any GUI interaction or any change of the currently active BaseDocument must only happen from the main thread. To make sure that such code is only executed in the main thread the following functions can be used:
- GeIsMainThread(): Returns true if the code is running in the context of the main thread.
- GeIsMainThreadAndNoDrawThread(): Returns true if the code is running in the context of the main thread and if the main thread does not execute any viewport drawing.
{
{
}
}
BaseDocument * GetActiveDocument()
void EventAdd(EVENT eventflag=EVENT::NONE)
Bool GeIsMainThreadAndNoDrawThread()
Definition: c4d_basedocument.h:497
Definition: c4d_basetime.h:25
maxon::Float Float
Definition: ge_sys_math.h:62
return OK
Definition: apibase.h:2735
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
#define CriticalStop(...)
Definition: debugdiagnostics.h:231
const char * doc
Definition: pyerrors.h:226
Running Systems
- Note
- CheckIsRunning() does not check if the current code is running within the context of the checked task. See IdentifyThread() above.
{
}
Bool CheckIsRunning(CHECKISRUNNING type)
Bool GeStopBackgroundThreads(Int32 typeclass, BACKGROUNDHANDLERFLAGS flags, BaseThread *thread)
#define BACKGROUNDHANDLER_TYPECLASS_C4D
Cinema 4D background handler type class.
Definition: ge_prepass.h:4876
@ RENDEREXTERNAL
Render external.
@ EXTERNALRENDERING
External rendering.
Get Threads
These functions are used to obtain certain threads:
if (escThread == nullptr)
{
DoSomething();
}
BaseThread * GeGetEscTestThread()
Definition: c4d_thread.h:209
Definition: c4d_thread.h:29
Bool TestBreak()
Definition: c4d_thread.h:40
Further Reading