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]
pub fn coerce<T: nsIThreadPoolCoerce>(&self) -> &T
[src]
Cast this nsIThreadPool
to one of its base interfaces.
impl nsIThreadPool
[src]
pub unsafe fn Shutdown(&self) -> nsresult
[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 ();
pub unsafe fn GetThreadLimit(&self, aThreadLimit: *mut uint32_t) -> nsresult
[src]
/**
* Get/set the maximum number of threads allowed at one time in this pool.
*/
attribute unsigned long threadLimit;
pub unsafe fn SetThreadLimit(&self, aThreadLimit: uint32_t) -> nsresult
[src]
/**
* Get/set the maximum number of threads allowed at one time in this pool.
*/
attribute unsigned long threadLimit;
pub unsafe fn GetIdleThreadLimit(
&self,
aIdleThreadLimit: *mut uint32_t
) -> nsresult
[src]
&self,
aIdleThreadLimit: *mut uint32_t
) -> nsresult
/**
* Get/set the maximum number of idle threads kept alive.
*/
attribute unsigned long idleThreadLimit;
pub unsafe fn SetIdleThreadLimit(&self, aIdleThreadLimit: uint32_t) -> nsresult
[src]
/**
* Get/set the maximum number of idle threads kept alive.
*/
attribute unsigned long idleThreadLimit;
pub unsafe fn GetIdleThreadTimeout(
&self,
aIdleThreadTimeout: *mut uint32_t
) -> nsresult
[src]
&self,
aIdleThreadTimeout: *mut uint32_t
) -> nsresult
/**
* Get/set the amount of time in milliseconds before an idle thread is
* destroyed.
*/
attribute unsigned long idleThreadTimeout;
pub unsafe fn SetIdleThreadTimeout(
&self,
aIdleThreadTimeout: uint32_t
) -> nsresult
[src]
&self,
aIdleThreadTimeout: uint32_t
) -> nsresult
/**
* Get/set the amount of time in milliseconds before an idle thread is
* destroyed.
*/
attribute unsigned long idleThreadTimeout;
pub unsafe fn GetThreadStackSize(
&self,
aThreadStackSize: *mut uint32_t
) -> nsresult
[src]
&self,
aThreadStackSize: *mut uint32_t
) -> nsresult
/**
* 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;
pub unsafe fn SetThreadStackSize(&self, aThreadStackSize: uint32_t) -> nsresult
[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;
pub unsafe fn GetListener(
&self,
aListener: *mut *const nsIThreadPoolListener
) -> nsresult
[src]
&self,
aListener: *mut *const nsIThreadPoolListener
) -> nsresult
/**
* 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;
pub unsafe fn SetListener(
&self,
aListener: *const nsIThreadPoolListener
) -> nsresult
[src]
&self,
aListener: *const nsIThreadPoolListener
) -> nsresult
/**
* 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;
pub unsafe fn SetName(&self, aName: &nsACString) -> nsresult
[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>
pub fn coerce<T: nsIEventTargetCoerce>(&self) -> &T
[src]
Cast this nsIEventTarget
to one of its base interfaces.
pub const DISPATCH_NORMAL: i64
pub const DISPATCH_SYNC: i64
pub const DISPATCH_AT_END: i64
pub unsafe fn IsOnCurrentThreadInfallible(&self) -> bool
[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 ();
pub unsafe fn IsOnCurrentThread(&self, _retval: *mut bool) -> nsresult
[src]
boolean isOnCurrentThread ();
pub unsafe fn DispatchFromScript(
&self,
event: *const nsIRunnable,
flags: uint32_t
) -> nsresult
[src]
&self,
event: *const nsIRunnable,
flags: uint32_t
) -> nsresult
/**
* 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]
const IID: nsIID
IID: nsIID = nsID(1993251273, 36419, 18586, [151, 137, 242, 124, 196, 66, 73, 101])
fn query_interface<T: XpCom>(&self) -> Option<RefPtr<T>>
[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]
unsafe fn addref(&self)
[src]
Increment the reference count.
unsafe fn release(&self)
[src]
Decrement the reference count, potentially freeing backing memory.
impl Deref for nsIThreadPool
[src]
type Target = nsIEventTarget
The resulting type after dereferencing.
fn deref(&self) -> &nsIEventTarget
[src]
Dereferences the value.