Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes
nsIThread Interface Reference

import "nsIThread.idl";

Inheritance diagram for nsIThread:
Inheritance graph
[legend]
Collaboration diagram for nsIThread:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void join ()
void interrupt ()
PRThread GetPRThread ()
void init (in nsIRunnable aRunnable, in PRUint32 aStackSize, in PRThreadPriority aPriority, in PRThreadScope aScope, in PRThreadState aState)
void sleep (in PRUint32 msec)

Static Public Member Functions

static NS_COM nsresult GetCurrent (nsIThread **result)
static NS_COM nsresult GetIThread (PRThread *prthread, nsIThread **result)
static NS_COM nsresult SetMainThread ()
static NS_COM nsresult GetMainThread (nsIThread **result)
static NS_COM PRBool IsMainThread ()

Public Attributes

const PRUint32 PRIORITY_LOW = 0
const PRUint32 PRIORITY_NORMAL = 1
const PRUint32 PRIORITY_HIGH = 2
const PRUint32 PRIORITY_URGENT = 3
const PRUint32 SCOPE_LOCAL = 0
const PRUint32 SCOPE_GLOBAL = 1
const PRUint32 SCOPE_BOUND = 2
const PRUint32 STATE_JOINABLE = 0
const PRUint32 STATE_UNJOINABLE = 1
attribute PRThreadPriority priority
readonly attribute PRThreadScope scope
readonly attribute PRThreadState state
readonly attribute nsIThread currentThread

Detailed Description

Definition at line 69 of file nsIThread.idl.


Member Function Documentation

Definition at line 402 of file nsThread.cpp.

{
    return GetIThread(PR_GetCurrentThread(), result);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_COM nsresult nsIThread::GetIThread ( PRThread prthread,
nsIThread **  result 
) [static]

Definition at line 408 of file nsThread.cpp.

{
    PRStatus status;
    nsThread* thread;

    if (nsThread::kIThreadSelfIndex == 0) {
        status = PR_NewThreadPrivateIndex(&nsThread::kIThreadSelfIndex, nsThread::Exit);
        if (status != PR_SUCCESS) return NS_ERROR_FAILURE;
    }

    thread = (nsThread*)PR_GetThreadPrivate(nsThread::kIThreadSelfIndex);
    if (thread == nsnull) {
        // if the current thread doesn't have an nsIThread associated
        // with it, make one
        thread = new nsThread();
        if (thread == nsnull)
            return NS_ERROR_OUT_OF_MEMORY;
        NS_ADDREF(thread);      // released by Exit
        thread->SetPRThread(prthread);
        nsresult rv = thread->RegisterThreadSelf();
        if (NS_FAILED(rv)) return rv;
    }
    NS_ADDREF(thread);
    *result = thread;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 448 of file nsThread.cpp.

{
    NS_ASSERTION(result, "bad result pointer");
    if (gMainThread == 0)
        return NS_ERROR_FAILURE;
    *result = gMainThread;
    NS_ADDREF(gMainThread);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

void nsIThread::init ( in nsIRunnable  aRunnable,
in PRUint32  aStackSize,
in PRThreadPriority  aPriority,
in PRThreadScope  aScope,
in PRThreadState  aState 
)

Definition at line 459 of file nsThread.cpp.

{
    if (gMainThread == 0)
        return PR_TRUE;
    
    PRThread *theMainThread;
    gMainThread->GetPRThread(&theMainThread);
    return theMainThread == PR_GetCurrentThread();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 436 of file nsThread.cpp.

{
    // strictly speaking, it could be set twice. but practically speaking,
    // it's almost certainly an error if it is
    if (gMainThread != 0) {
        NS_ERROR("Setting main thread twice?");
        return NS_ERROR_FAILURE;
    }
    return GetCurrent(&gMainThread);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 102 of file nsIThread.idl.

Definition at line 87 of file nsIThread.idl.

Definition at line 74 of file nsIThread.idl.

Definition at line 72 of file nsIThread.idl.

Definition at line 73 of file nsIThread.idl.

Definition at line 75 of file nsIThread.idl.

Definition at line 88 of file nsIThread.idl.

Definition at line 79 of file nsIThread.idl.

Definition at line 78 of file nsIThread.idl.

Definition at line 77 of file nsIThread.idl.

Definition at line 89 of file nsIThread.idl.

Definition at line 81 of file nsIThread.idl.

Definition at line 82 of file nsIThread.idl.


The documentation for this interface was generated from the following files: