Visit Mozilla.org

nsIThreadManager

From MDC

This article covers features introduced in Firefox 3

The nsIThreadManager interface lets applications and extensions create and manage threads, each of which is represented by an nsIThread.

Contents

nsIThreadManager is defined in xpcom/threads/nsIThreadManager.idl. It is scriptable and unfrozen (hasn't changed since Mozilla 1.9).

Inherits from: nsISupports

[edit] Method overview

nsIThread newThread(in unsigned long creationFlags)
[noscript] nsIThread getThreadFromPRThread(in PRThread prthread)

[edit] Attributes

Attribute Type Description
mainThread nsIThread The main thread. Read only.
currentThread nsIThread The currently executing thread. If the calling thread doesn't already have an nsIThread associated with it, one is created and associate with the current PRThread. Read only.
isMainThread boolean Returns true if the currently executing thread is the main thread. Read only.

[edit] Methods

[edit] newThread()

Create a new thread. Internally, this is a global user PRThread.

nsIThread newThread(
  in unsigned long creationFlags
)
[edit] Parameters
creationFlags
Reserved for future use; pass 0.
[edit] Return value

The newly created nsIThread.

[edit] getThreadFromPRThread()

Given a PRThread, this method returns the corresponding nsIThread. Returns null if there isn't a corresponding nsIThread.

Note: This method may only be called from native code.
[noscript] nsIThread getThreadFromPRThread(
  in PRThread prthread
)
[edit] Parameters
prthread
The PRThread for which to retrieve the corresponding nsIThread.
[edit] Return value

The nsIThread matching the specified PRThread, or null if there is no matching nsIThread.

[edit] See also