272
edits
m (→Interfaces) |
m (→Interfaces) |
||
| Line 18: | Line 18: | ||
nsIThread getThread(in ACString name); | nsIThread getThread(in ACString name); | ||
| | ||
/** | |||
* Get the nsIThread object (if any) corresponding to the given PRThread. | |||
* This method returns null if there is no corresponding nsIThread. | |||
*/ | |||
[noscript] nsIThread getThreadFromPRThread(in PRThread thread); | |||
/** | /** | ||
* Get the main thread. | * Get the main thread. | ||
| Line 27: | Line 32: | ||
*/ | */ | ||
readonly attribute nsIThread currentThread; | readonly attribute nsIThread currentThread; | ||
| |||
/** | |||
* This attribute is true if the calling thread is the main thread of the | |||
* application process. | |||
*/ | |||
readonly attribute boolean isMainThread; | |||
| | ||
/** | /** | ||
| Line 38: | Line 49: | ||
*/ | */ | ||
nsIThread setCurrentThread(in nsIThread thread); | nsIThread setCurrentThread(in nsIThread thread); | ||
}; | }; | ||
[scriptable, uuid(...)] | [scriptable, uuid(...)] | ||
interface | interface nsIEventTarget : nsISupports { | ||
/** | /** | ||
* Dispatch | * Dispatch an event to the target. This function may be called from any | ||
* thread. If flags specifies DISPATCH_SYNC, then the dispatch method | * thread. If flags specifies DISPATCH_SYNC, then the dispatch method | ||
* will not return until the | * will not return until the event has been processed. NOTE: Calling | ||
* with DISPATCH_SYNC, may have the side-effect of running other | * dispatch with DISPATCH_SYNC, may have the side-effect of running other | ||
* on the current thread while waiting for the given | * events on the current thread while waiting for the given event to run | ||
* completion. This function is re-entrant. | * to completion. This function is thread-safe and re-entrant. | ||
*/ | */ | ||
void dispatch(in nsIRunnable | void dispatch(in nsIRunnable event, in unsigned long flags); | ||
const unsigned long DISPATCH_NORMAL = 0; | const unsigned long DISPATCH_NORMAL = 0; | ||
const unsigned long DISPATCH_SYNC = 1; | const unsigned long DISPATCH_SYNC = 1; | ||
| | ||
/** | /** | ||
* Returns true if | * Returns true if events dispatched to this target will run on the | ||
* current thread (i.e., the thread calling this method). | * current thread (i.e., the thread calling this method). | ||
*/ | */ | ||
| Line 68: | Line 73: | ||
[scriptable, uuid(...)] | [scriptable, uuid(...)] | ||
interface nsIThread : | interface nsIThread : nsIEventTarget { | ||
/** | /** | ||
* Returns the name of the thread, which may be empty if this thread is | * Returns the name of the thread, which may be empty if this thread is | ||
| Line 74: | Line 79: | ||
*/ | */ | ||
readonly attribute ACString name; | readonly attribute ACString name; | ||
| |||
/** | |||
* Returns the PRThread object corresponding to this nsIThread. | |||
*/ | |||
[noscript] PRThread getPRThread(); | |||
| | ||
/** | /** | ||
edits