XPCOM:nsIThreadManager: Difference between revisions

m
Line 180: Line 180:
nsThreadUtils.h defines the following helper functions:
nsThreadUtils.h defines the following helper functions:


/**
  * Create a new thread.
  *
  * @param name
  *        The name of the thread (must be unique) or the empty string to
  *        create an anonymous thread.
  * @param event
  *        The initial event to run on this thread.  This can be null.
  * @param result
  *        The resulting nsIThread object.
  */
  NS_METHOD NS_NewThread(const nsACString &name, nsIRunnable *event,
  NS_METHOD NS_NewThread(const nsACString &name, nsIRunnable *event,
                         nsIThread **result);
                         nsIThread **result);
   
   
/**
  * Get a reference to the current thread.
  *
  * @param result
  *        The resulting nsIThread object.
  */
  NS_METHOD NS_GetCurrentThread(nsIThread **result);
  NS_METHOD NS_GetCurrentThread(nsIThread **result);
   
   
/**
  * Get a reference to the main thread.
  *
  * @param result
  *        The resulting nsIThread object.
  */
  NS_METHOD NS_GetMainThread(nsIThread **result);
  NS_METHOD NS_GetMainThread(nsIThread **result);
   
   
/**
  * Get a reference to the thread with the given name.
  *
  * @param name
  *        The name of the requested thread.  Must be non-empty.
  * @param result
  *        The resulting nsIThread object.
  */
  NS_METHOD NS_GetThread(const nsACString &name, nsIThread **result);
  NS_METHOD NS_GetThread(const nsACString &name, nsIThread **result);
   
   
/**
  * Test to see if the current thread is the main thread.
  *
  * @returns PR_TRUE if the current thread is the main thread, and PR_FALSE
  * otherwise.
  */
  PRBool NS_IsMainThread();
  PRBool NS_IsMainThread();


272

edits