Agora Java API Reference for Android
Classes | Static Public Member Functions | List of all members
io.agora.rtc.utils.ThreadUtils Class Reference

Classes

interface  BlockingOperation
 
class  ThreadChecker
 

Static Public Member Functions

static void checkIsOnMainThread ()
 
static void executeUninterruptibly (BlockingOperation operation)
 
static boolean joinUninterruptibly (final Thread thread, long timeoutMs)
 
static void joinUninterruptibly (final Thread thread)
 
static void awaitUninterruptibly (final CountDownLatch latch)
 
static boolean awaitUninterruptibly (CountDownLatch barrier, long timeoutMs)
 
static void waitUninterruptibly (final Object object)
 
static< V > V invokeAtFrontUninterruptibly (final Handler handler, final Callable< V > callable)
 
static void invokeAtFrontUninterruptibly (final Handler handler, final Runnable runner)
 
static StackTraceElement [] concatStackTraces (StackTraceElement[] inner, StackTraceElement[] outer)
 

Member Function Documentation

◆ checkIsOnMainThread()

static void io.agora.rtc.utils.ThreadUtils.checkIsOnMainThread ( )
static

Throws exception if called from other than main thread.

◆ executeUninterruptibly()

static void io.agora.rtc.utils.ThreadUtils.executeUninterruptibly ( BlockingOperation  operation)
static

Utility method to make sure a blocking operation is executed to completion without getting interrupted. This should be used in cases where the operation is waiting for some critical work, e.g. cleanup, that must complete before returning. If the thread is interrupted during the blocking operation, this function will re-run the operation until completion, and only then re-interrupt the thread.

◆ invokeAtFrontUninterruptibly() [1/2]

static <V> V io.agora.rtc.utils.ThreadUtils.invokeAtFrontUninterruptibly ( final Handler  handler,
final Callable< V >  callable 
)
static

Post |callable| to |handler| and wait for the result.

◆ invokeAtFrontUninterruptibly() [2/2]

static void io.agora.rtc.utils.ThreadUtils.invokeAtFrontUninterruptibly ( final Handler  handler,
final Runnable  runner 
)
static

Post |runner| to |handler|, at the front, and wait for completion.