Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Firefox/mozglue/misc/   (Firefox Browser Version 153.0.1©)  Datei vom 27.6.2026 mit Größe 1 kB image not shown  

Quelle  Futex_windows.cpp

  Sprache: C
 

/* 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/. */


#include "mozilla/Futex.h"

#include <windows.h>

namespace mozilla {

static DWORD ConvertTimeout(const TimeDuration* aTimeout) {
  if (!aTimeout || *aTimeout == TimeDuration::Forever()) {
    return INFINITE;
  }
  double msecd = aTimeout->ToMilliseconds();
  if (msecd < 0.0) {
    return 0;
  }
  if (msecd > UINT32_MAX) {
    return INFINITE;
  }
  DWORD msec = static_cast<DWORD>(msecd);
  // Round sub-millisecond waits up to 1ms (bug 1437167 comment 6).
  if (msec == 0 && !aTimeout->IsZero()) {
    msec = 1;
  }
  return msec;
}

template <typename T>
bool FutexImpl<T>::wait(T aExpected, const TimeDuration* aTimeout) {
  return ::WaitOnAddress(reinterpret_cast<volatile void*>(&mValue), &aExpected,
                         sizeof(aExpected), ConvertTimeout(aTimeout));
}

template <typename T>
void FutexImpl<T>::wake() {
  ::WakeByAddressSingle(reinterpret_cast<void*>(&mValue));
}

template <typename T>
void FutexImpl<T>::wakeAll() {
  ::WakeByAddressAll(reinterpret_cast<void*>(&mValue));
}

template struct FutexImpl<uint32_t>;
template struct FutexImpl<uint8_t>;

}  // namespace mozilla

Messung V0.5 in Prozent
C=92 H=96 G=93

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

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 und die Messung sind noch experimentell.