Package 

Object ThreadUtils


  • 
    public class ThreadUtils
    
                        

    Thread management utilities for the CloudX SDK.

    Provides optimized thread pools and executors for different types of operations, ensuring efficient resource usage and proper thread lifecycle management.

    • Method Detail

      • createMainScope

         final CoroutineScope createMainScope(String tag)

        Convenience method to create a main-thread component scope (uses Main dispatcher). Use for UI-related components like ad managers, UI controllers, etc.

      • createIOScope

         final CoroutineScope createIOScope(String tag)

        Convenience method to create a background component scope (uses IO dispatcher). Use for background components like trackers, network managers, etc.

      • executeWithTimeout

         final <T extends Any> T executeWithTimeout(Long timeoutMs, CoroutineContext context, SuspendFunction1<CoroutineScope, T> block)

        Execute a suspend function with timeout and error handling.

        Parameters:
        timeoutMs - timeout in milliseconds
        context - coroutine context to use
        block - the suspend function to execute