GemCall

object GemCall

This helper class is intended for placing calls on the same thread as the map engine runs on and the purpose is to solve concurrence read/write calls. Avoid using the SDK without placing calls on other thread than the engine one!

Properties

Link copied to clipboard
val lock: Any

Magic Lane SDK's lock. Used to sync GLThread and SdkThread calls.

Functions

Link copied to clipboard

Often used before upcoming GemCall calls that requires to run on engine thread. This method is not required to be used. It is an useful tool for avoiding wrong thread problems. If this method throws exception then wrong thread will be used to call upcoming GemCall calls.

Link copied to clipboard

Often used before upcoming calls that requires to run on GEMSdkThread or GLThread. This method is not required to be used. It is an useful tool for avoiding wrong thread problems. If this method throws exception then the upcoming calls would be placed on a wrong thread.

Link copied to clipboard
fun <T> execute(task: () -> T): T?
fun <T> execute(task: () -> T, maxWaitMs: Long): T?

Executing the task on sdk thread. The task will run async on sdk thread. If callee thread is different than sdk thread then it will wait until task finishes. If callee thread is the same with sdk thread then the task will run immediately.

Link copied to clipboard

Gets the GEM SDK's engine thread id.

Link copied to clipboard

Check if sdkHandler (GEMSdkThread) is locked.

Link copied to clipboard

Returns true if the callee thread is the same with GemSDK Thread else false.

Link copied to clipboard
fun postAsync(task: () -> Unit)

Posts the task on sdk thread. The task will run async on sdk call. Post will happen without any delay.

fun postAsync(task: () -> Unit, delayMillis: Long)

Posts the task on sdk thread. The task will run async on sdk call. The task would be posted with delay in milliseconds.

Link copied to clipboard
fun <T> postSync(task: () -> T): T?

Executing the task on sdk thread. The task will run async on sdk thread. If callee thread is different than sdk thread then it will wait until task finishes. If callee thread is the same with sdk thread then the task will run immediately.

Link copied to clipboard
fun reinit()

reinitialise this handler

Link copied to clipboard
fun <T> runSynced(task: () -> T?): T?

Executes the given function task while holding the monitor of the given object lock and returns the task's result