XPCOM:nsIThreadManager: Difference between revisions

Jump to navigation Jump to search
m
Line 168: Line 168:
  };
  };


== Helper Functions ==
== Utilities ==


nsThreadUtils.h defines the following helper functions:
nsThreadUtils.h defines the following helper functions:
Line 186: Line 186:
  PRBool
  PRBool
  NS_IsMainThread();
  NS_IsMainThread();
The following nsCOMPtr helpers are defined to simplify things further:
already_AddRefed<nsIThread>
do_GetCurrentThread();
&nbsp;
already_AddRefed<nsIThread>
do_GetMainThread()
&nbsp;
already_AddRefed<nsIThread>
do_GetThread(const nsACString &name)
The class <code>nsRunnable</code> is also defined to simplify the
implementation of new event types.  For example, to define a new
event all you need to do is write code like this:
class MyEvent : public nsRunnable {
public:
  MyEvent(... params ...);
  &nbsp;
  NS_IMETHOD Run() {
    // do stuff
    return NS_OK;
  }
};


== Remarks ==
== Remarks ==
272

edits

Navigation menu