XPCOM:nsIThreadManager: Difference between revisions

m
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);
   
  /**
    * This attribute is true if the calling thread is the main thread of the
    * application process.
    */
  readonly attribute boolean isMainThread;
  };
  };


  [scriptable, uuid(...)]
  [scriptable, uuid(...)]
  interface nsIDispatchTarget : nsISupports {
  interface nsIEventTarget : nsISupports {
   /**
   /**
     * Dispatch a task to the target.  This function may be called from any
     * 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 task has been run.  NOTE: Calling dispatch
     * will not return until the event has been processed.  NOTE: Calling  
     * with DISPATCH_SYNC, may have the side-effect of running other tasks
     * dispatch with DISPATCH_SYNC, may have the side-effect of running other  
     * on the current thread while waiting for the given task to run to
     * 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 task, in unsigned long flags);
   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 tasks dispatched to this target will run on the
     * 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 : nsIDispatchTarget {
  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();
    
    
   /**
   /**
272

edits