Cinema 4D is a multi-threaded application that handles different tasks in different threads. Certain operations can only be performed from within the main thread. So a plugin must know its current thread context. For details see Cinema 4D Threads Manual.

Both the classic API and the MAXON API provide tools to handle threads, create custom threads and to perform operations multi-threaded.

See Classic API Threading and MAXON API Threading.