Interface nsIThreadManagerType

An interface for creating and locating nsIThread instances.

Hierarchy

Properties

currentThread: nsIThread

Get the current thread. If the calling thread does not already have a nsIThread associated with it, then a new nsIThread will be created and associated with the current PRThread.

mainThread: nsIThread

Get the main thread.

mainThreadEventTarget: nsIEventTarget

Return the EventTarget for the main thread.

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • A helper method to dispatch a task through nsIDirectTaskDispatcher to the current thread.

    Parameters

    • event: nsIRunnable

    Returns void

  • This queues a runnable to the main thread. It's a shortcut for JS callers to be used instead of .mainThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORMAL); or .currentThread.dispatch(runnable, Ci.nsIEventTarget.DISPATCH_NORMAL); C++ callers should instead use NS_DispatchToMainThread.

    Parameters

    • event: nsIRunnable
    • priority: uint32_t

    Returns void

  • Similar to dispatchToMainThread, but wraps the event with extra runnable that allocates nsAutoMicroTask.

    Parameters

    • event: nsIRunnable
    • priority: uint32_t

    Returns void

  • This queues a runnable to the main thread's idle queue.

    Parameters

    • event: nsIRunnable

      The event to dispatch.

    • timeout: uint32_t

      The time in milliseconds until this event should be moved from the idle queue to the regular queue if it hasn't been executed by then. If not passed or a zero value is specified, the event will never be moved to the regular queue.

    Returns void

  • Create a new thread (a global, user PRThread) with the specified name.

    Returns

    The newly created nsIThread object.

    Parameters

    • name: string

      The name of the thread. If it is empty the thread will not be named.

    • options: ThreadCreationOptions

      Configuration options for the newly created thread.

    Returns nsIThread

  • Enter a nested event loop on the current thread, waiting on, and processing events until condition.isDone() returns true.

    If condition.isDone() throws, this function will throw as well.

    C++ code should not use this function, instead preferring mozilla::SpinEventLoopUntil.

    Parameters

    • aVeryGoodReasonToDoThis: string
    • condition: nsINestedEventLoopCondition

    Returns void

  • Spin the current thread's event loop until there are no more pending events. This could be done with spinEventLoopUntil, but that would require access to the current thread from JavaScript, which we are moving away from.

    Returns void

  • Similar to the previous method, but the spinning of the event loop terminates when the quit application shutting down starts.

    C++ code should not use this function, instead preferring mozilla::SpinEventLoopUntil.

    Parameters

    • aVeryGoodReasonToDoThis: string
    • condition: nsINestedEventLoopCondition

    Returns void

Generated using TypeDoc