Struct xpcom::interfaces::nsIThreadPool [] [src]

#[repr(C)]
pub struct nsIThreadPool { /* fields omitted */ }

interface nsIThreadPool : nsIEventTarget

/**
 * An interface to a thread pool.  A thread pool creates a limited number of
 * anonymous (unnamed) worker threads.  An event dispatched to the thread pool
 * will be run on the next available worker thread.
 */

Methods

impl nsIThreadPool
[src]

[src]

Cast this nsIThreadPool to one of its base interfaces.

impl nsIThreadPool
[src]

[src]

/**
   * Shutdown the thread pool.  This method may not be executed from any thread
   * in the thread pool.  Instead, it is meant to be executed from another
   * thread (usually the thread that created this thread pool).  When this
   * function returns, the thread pool and all of its threads will be shutdown,
   * and it will no longer be possible to dispatch tasks to the thread pool.
   *
   * As a side effect, events on the current thread will be processed.
   */

void shutdown ();

[src]

/**
   * Get/set the maximum number of threads allowed at one time in this pool.
   */

attribute unsigned long threadLimit;

[src]

/**
   * Get/set the maximum number of threads allowed at one time in this pool.
   */

attribute unsigned long threadLimit;

[src]

/**
   * Get/set the maximum number of idle threads kept alive.
   */

attribute unsigned long idleThreadLimit;

[src]

/**
   * Get/set the maximum number of idle threads kept alive.
   */

attribute unsigned long idleThreadLimit;

[src]

/**
   * Get/set the amount of time in milliseconds before an idle thread is
   * destroyed.
   */

attribute unsigned long idleThreadTimeout;

[src]

/**
   * Get/set the amount of time in milliseconds before an idle thread is
   * destroyed.
   */

attribute unsigned long idleThreadTimeout;

[src]

/**
   * Get/set the number of bytes reserved for the stack of all threads in
   * the pool. By default this is nsIThreadManager::DEFAULT_STACK_SIZE.
   */

attribute unsigned long threadStackSize;

[src]

/**
   * Get/set the number of bytes reserved for the stack of all threads in
   * the pool. By default this is nsIThreadManager::DEFAULT_STACK_SIZE.
   */

attribute unsigned long threadStackSize;

[src]

/**
   * An optional listener that will be notified when a thread is created or
   * destroyed in the course of the thread pool's operation.
   *
   * A listener will only receive notifications about threads created after the
   * listener is set so it is recommended that the consumer set the listener
   * before dispatching the first event. A listener that receives an
   * onThreadCreated() notification is guaranteed to always receive the
   * corresponding onThreadShuttingDown() notification.
   *
   * The thread pool takes ownership of the listener and releases it when the
   * shutdown() method is called. Threads created after the listener is set will
   * also take ownership of the listener so that the listener will be kept alive
   * long enough to receive the guaranteed onThreadShuttingDown() notification.
   */

attribute nsIThreadPoolListener listener;

[src]

/**
   * An optional listener that will be notified when a thread is created or
   * destroyed in the course of the thread pool's operation.
   *
   * A listener will only receive notifications about threads created after the
   * listener is set so it is recommended that the consumer set the listener
   * before dispatching the first event. A listener that receives an
   * onThreadCreated() notification is guaranteed to always receive the
   * corresponding onThreadShuttingDown() notification.
   *
   * The thread pool takes ownership of the listener and releases it when the
   * shutdown() method is called. Threads created after the listener is set will
   * also take ownership of the listener so that the listener will be kept alive
   * long enough to receive the guaranteed onThreadShuttingDown() notification.
   */

attribute nsIThreadPoolListener listener;

[src]

/**
   * Set the label for threads in the pool. All threads will be named
   * "<aName> #<n>", where <n> is a serial number.
   */

void setName (in ACString aName);

Methods from Deref<Target = nsIEventTarget>

[src]

Cast this nsIEventTarget to one of its base interfaces.

[src]

/**
   * IsOnCurrentThread() should return true if events dispatched to this target
   * can possibly run on the current thread, and false otherwise. In the case
   * of an nsIEventTarget for a thread pool, it should return true on all
   * threads in the pool. In the case of a non-thread nsIEventTarget such as
   * ThrottledEventQueue, it should return true on the thread where events are
   * expected to be processed, even if no events from the queue are actually
   * being processed right now.
   *
   * When called on an nsISerialEventTarget, IsOnCurrentThread can be used to
   * ensure that no other thread has "ownership" of the event target. As such,
   * it's useful for asserting that an object is only used on a particular
   * thread. IsOnCurrentThread can't guarantee that the current event has been
   * dispatched through a particular event target.
   *
   * The infallible version of IsOnCurrentThread() is optimized to avoid a
   * virtual call for non-thread event targets. Thread targets should set
   * mVirtualThread to their virtual PRThread. Non-thread targets should leave
   * mVirtualThread null and implement IsOnCurrentThreadInfallible() to
   * return the correct answer.
   *
   * The fallible version of IsOnCurrentThread may return errors, such as during
   * shutdown. If it does not return an error, it should return the same result
   * as the infallible version. The infallible method should return the correct
   * result regardless of whether the fallible method returns an error.
   */

[noscript,notxpcom] boolean isOnCurrentThreadInfallible ();

[src]

boolean isOnCurrentThread ();

[src]

/**
   * Version of Dispatch to expose to JS, which doesn't require an alreadyAddRefed<>
   * (it will be converted to that internally)
   *
   * @param event
   *   The (raw) event to dispatch.
   * @param flags
   *   The flags modifying event dispatch.  The flags are described in detail
   *   below.
   *
   * @throws NS_ERROR_INVALID_ARG
   *   Indicates that event is null.
   * @throws NS_ERROR_UNEXPECTED
   *   Indicates that the thread is shutting down and has finished processing
   * events, so this event would never run and has not been dispatched.
   */

[binaryname(DispatchFromScript)] void dispatch (in nsIRunnable event, in unsigned long flags);

Trait Implementations

impl XpCom for nsIThreadPool
[src]

IID: nsIID = nsID(1993251273, 36419, 18586, [151, 137, 242, 124, 196, 66, 73, 101])

[src]

Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more

impl RefCounted for nsIThreadPool
[src]

[src]

Increment the reference count.

[src]

Decrement the reference count, potentially freeing backing memory.

impl Deref for nsIThreadPool
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.