Class WorkQueue
Base class providing some utility work queue to dispatch free-threaded actions to the main Unity application thread, where the handler(s) can safely access Unity objects.
Namespace: Microsoft.MixedReality.WebRTC.Unity
Assembly: cs.temp.dll.dll
Syntax
public class WorkQueue : MonoBehaviour
Properties
IsMainAppThread
Check if the current thread is the main Unity application thread where it is safe to access Unity objects.
Declaration
public bool IsMainAppThread { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Should be only called once the object is awake.
Methods
Awake()
Declaration
protected virtual void Awake()
EnsureIsMainAppThread()
Ensure the current method is running on the main Unity application thread.
Declaration
public void EnsureIsMainAppThread()
Remarks
Should be only called once the object is awake.
InvokeOnAppThread(Action)
Invoke the specified action on the main Unity app thread.
Declaration
public void InvokeOnAppThread(Action action)
Parameters
Type | Name | Description |
---|---|---|
Action | action | The action to execute. |
Remarks
If this object is awake, and this method is called from the main Unity app thread,
action
will be executed synchronously. Otherwise,
action
will be called during the next call to this object's Update().
Update()
Implementation of MonoBehaviour.Update to execute from the main Unity app thread any background work enqueued from free-threaded callbacks.
Declaration
protected virtual void Update()