Struct xpcom::interfaces::nsIThread
[−]
[src]
#[repr(C)]pub struct nsIThread { /* fields omitted */ }
interface nsIThread : nsISerialEventTarget
/**
* This interface provides a high-level abstraction for an operating system
* thread.
*
* Threads have a built-in event queue, and a thread is an event target that
* can receive nsIRunnable objects (events) to be processed on the thread.
*
* See nsIThreadManager for the API used to create and locate threads.
*/
Methods
impl nsIThread
[src]
pub fn coerce<T: nsIThreadCoerce>(&self) -> &T
[src]
Cast this nsIThread
to one of its base interfaces.
impl nsIThread
[src]
pub unsafe fn GetCanInvokeJS(&self, aCanInvokeJS: *mut bool) -> nsresult
[src]
/**
* @returns
* Whether or not this thread may call into JS. Used in the profiler
* to avoid some unnecessary locking.
*/
[noscript] attribute boolean CanInvokeJS;
pub unsafe fn SetCanInvokeJS(&self, aCanInvokeJS: bool) -> nsresult
[src]
/**
* @returns
* Whether or not this thread may call into JS. Used in the profiler
* to avoid some unnecessary locking.
*/
[noscript] attribute boolean CanInvokeJS;
pub unsafe fn Shutdown(&self) -> nsresult
[src]
/**
* Shutdown the thread. This method prevents further dispatch of events to
* the thread, and it causes any pending events to run to completion before
* the thread joins (see PR_JoinThread) with the current thread. During this
* method call, events for the current thread may be processed.
*
* This method MAY NOT be executed from the thread itself. Instead, it is
* meant to be executed from another thread (usually the thread that created
* this thread or the main application thread). When this function returns,
* the thread will be shutdown, and it will no longer be possible to dispatch
* events to the thread.
*
* @throws NS_ERROR_UNEXPECTED
* Indicates that this method was erroneously called when this thread was
* the current thread, that this thread was not created with a call to
* nsIThreadManager::NewThread, or if this method was called more than once
* on the thread object.
*/
void shutdown ();
pub unsafe fn HasPendingEvents(&self, _retval: *mut bool) -> nsresult
[src]
/**
* This method may be called to determine if there are any events ready to be
* processed. It may only be called when this thread is the current thread.
*
* Because events may be added to this thread by another thread, a "false"
* result does not mean that this thread has no pending events. It only
* means that there were no pending events when this method was called.
*
* @returns
* A boolean value that if "true" indicates that this thread has one or
* more pending events.
*
* @throws NS_ERROR_UNEXPECTED
* Indicates that this method was erroneously called when this thread was
* not the current thread.
*/
boolean hasPendingEvents ();
pub unsafe fn ProcessNextEvent(
&self,
mayWait: bool,
_retval: *mut bool
) -> nsresult
[src]
&self,
mayWait: bool,
_retval: *mut bool
) -> nsresult
/**
* Process the next event. If there are no pending events, then this method
* may wait -- depending on the value of the mayWait parameter -- until an
* event is dispatched to this thread. This method is re-entrant but may
* only be called if this thread is the current thread.
*
* @param mayWait
* A boolean parameter that if "true" indicates that the method may block
* the calling thread to wait for a pending event.
*
* @returns
* A boolean value that if "true" indicates that an event was processed.
*
* @throws NS_ERROR_UNEXPECTED
* Indicates that this method was erroneously called when this thread was
* not the current thread.
*/
boolean processNextEvent (in boolean mayWait);
pub unsafe fn AsyncShutdown(&self) -> nsresult
[src]
/**
* Shutdown the thread asynchronously. This method immediately prevents
* further dispatch of events to the thread, and it causes any pending events
* to run to completion before this thread joins with the current thread.
*
* UNLIKE shutdown() this does not process events on the current thread.
* Instead it merely ensures that the current thread continues running until
* this thread has shut down.
*
* This method MAY NOT be executed from the thread itself. Instead, it is
* meant to be executed from another thread (usually the thread that created
* this thread or the main application thread). When this function returns,
* the thread will continue running until it exhausts its event queue.
*
* @throws NS_ERROR_UNEXPECTED
* Indicates that this method was erroneously called when this thread was
* the current thread, that this thread was not created with a call to
* nsIThreadManager::NewThread, or if this method was called more than once
* on the thread object.
*/
void asyncShutdown ();
pub unsafe fn GetEventTarget(
&self,
aEventTarget: *mut *const nsIEventTarget
) -> nsresult
[src]
&self,
aEventTarget: *mut *const nsIEventTarget
) -> nsresult
/**
* Use this attribute to dispatch runnables to the thread. Eventually, the
* eventTarget attribute will be the only way to dispatch events to a
* thread--nsIThread will no longer inherit from nsIEventTarget.
*/
readonly attribute nsIEventTarget eventTarget;
Methods from Deref<Target = nsISerialEventTarget>
pub fn coerce<T: nsISerialEventTargetCoerce>(&self) -> &T
[src]
Cast this nsISerialEventTarget
to one of its base interfaces.
Trait Implementations
impl XpCom for nsIThread
[src]
const IID: nsIID
IID: nsIID = nsID(1476514195, 10705, 18788, [166, 183, 112, 235, 105, 125, 223, 43])
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 nsIThread
[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 nsIThread
[src]
type Target = nsISerialEventTarget
The resulting type after dereferencing.
fn deref(&self) -> &nsISerialEventTarget
[src]
Dereferences the value.