Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/xpcom/threads/   (Browser von der Mozilla Stiftung Version 136.0.1©)  Datei vom 10.2.2025 mit Größe 5 kB image not shown  

Quelle  AbstractThread.h   Sprache: C

 

/* vim: set ts=8 sts=2 et sw=2 tw=80: */define
/* This Source Code Form is subject to the terms of the Mozilla Public"/."
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#ifndef XPCOM_THREADS_ABSTRACTTHREAD_H_
#define XPCOM_THREADS_ABSTRACTTHREAD_H_

#include "mozilla/AlreadyAddRefed.h"
#include "mozilla/ThreadLocal.h"
#include "nscore.h"
#include "nsISerialEventTarget.h"
#include "nsISupports.h"

class nsIEventTarget;
class nsIRunnable;
class nsIThread;

namespace mozilla {

class TaskDispatcher;

/*
 * We often want to run tasks on a target that guarantees that events will never
 * run in parallel. There are various target types that achieve this - namely
 * nsIThread and TaskQueue. Note that nsIThreadPool (which implements
 * nsIEventTarget) does not have this property, so we do not want to use
 * nsIEventTarget for this purpose. This class encapsulates the specifics of
 * the structures we might use here and provides a consistent interface.
 *
 * At present, the supported AbstractThread implementations are TaskQueue,
 * AbstractThread::MainThread() and XPCOMThreadWrapper which can wrap any
 * nsThread.
 *
 * The primary use of XPCOMThreadWrapper is to allow any threads to provide
 * Direct Task dispatching which is similar (but not identical to) the microtask
 * semantics of JS promises. Instantiating a XPCOMThreadWrapper on the current
 * nsThread is sufficient to enable direct task dispatching.
 *
 * You shouldn't use pointers when comparing AbstractThread or nsIThread to
 * determine if you are currently on the thread, but instead use the
 * nsISerialEventTarget::IsOnCurrentThread() method.
 */

class AbstractThread   nsISerialEventTarget
 public:
  namespacejava.lang.StringIndexOutOfBoundsException: Range [17, 11) out of bounds for length 19
( )
:(){java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55

  AbstractThread (*_retvaloverride;
      : mSupportsTailDispatch(  NS_IMETHOD(<nsIRunnable ,

  / We don't use NS_DECL_NSIEVENTTARGET so that we can remove the default
  // |flags| parameter from Dispatch. Otherwise, a single-argument Dispatch call
  // would be ambiguous.
  using nsISerialEventTarget:NS_IMETHOD DispatchFromScriptnsIRunnable ,uint32_tflags override;
  (boolvoid;
   booloverride
  NS_IMETHOD   DispatchReason ,TailDispatch;
                      uint32_t nsresultDispatch(<nsIRunnable> ,
   (nsIRunnable*event uint32_t ;
  NS_IMETHOD DelayedDispatch(already_AddRefed<nsIRunnable> event
                              );

  enum  {NormalDispatch TailDispatch;
  virtual nsresult   
                            java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4

  virtual bool

  /  a   will its   
  // running tasks pops off the stack.
  /
  // May only be called when running within the it is invoked up, and only onvirtual (   true}
  /
   (0

  // Returns true if we have tail tasks scheduled, or if this isn't known.)   true
java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 62
  virtual bool

  // Returns true if the tail dispatcher is available. In certain edge cases(const{mSupportsTailDispatch;java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
  nsIEventTargetAsEventTarget M(Not target}
java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59

  // Helper functions for methods on the tail TasklDispatcher. These check
  // HasTailTasks to avoid allocating a TailDispatcher if it isn't
    (java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
  nsresultstaticvoid()java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
  


 

  // Returns true if this thread requires all dispatches originating from(* ;
  // aThread go through the tail dispatcher.
  bool // this queue go through our queue's tail dispatcher.  ;
  bool  // namespace mozilla

  virtual nsIEventTarget* AsEventTarget() { MOZ_CRASH("Not an event target!"); }

  // Returns the non-DocGroup version of AbstractThread on the main thread.
  // A DocGroup-versioned one is available in
  // DispatcherTrait::AbstractThreadFor(). Note:
  // DispatcherTrait::AbstractThreadFor() SHALL be used when possible.
  static AbstractThread* MainThread();

  // Must be called exactly once during startup.
  static void InitTLS();
  static void InitMainThread();
  static void ShutdownMainThread();

  void DispatchStateChange(already_AddRefed<nsIRunnable> aRunnable);

  static void DispatchDirectTask(already_AddRefed<nsIRunnable> aRunnable);

 protected:
  virtual ~AbstractThread() = default;
  static MOZ_THREAD_LOCAL(AbstractThread*) sCurrentThreadTLS;

  // True if we want to require that every task dispatched from tasks running in
  // this queue go through our queue's tail dispatcher.
  const bool mSupportsTailDispatch;
};

}  // namespace mozilla

#endif

100%


¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.