Package 

Object ThreadUtils


  • @RestrictTo(value = {RestrictTo.Scope.LIBRARY_GROUP}) 
    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 Summary

      Modifier and Type Method Description
      final CoroutineScope createMainScope(String tag) Convenience method to create a main-thread component scope (uses Main dispatcher).
      final CoroutineScope createIOScope(String tag) Convenience method to create a background component scope (uses IO dispatcher).
      final Unit runOnMain(Function0<Unit> block) Run block on the main thread.
      final CoroutineDispatcher getMainDispatcher()
      final CoroutineDispatcher getIODispatcher()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.

      • runOnMain

         final Unit runOnMain(Function0<Unit> block)

        Run block on the main thread. Executes inline if already on main, otherwise posts to the main looper via a cached Handler.