products/Sources/formale Sprachen/C/Android/art/art/tools/ahat/src/test-dump/   (Android Betriebssystem Version 17©)  Datei vom 26.5.2026 mit Größe 10 kB image not shown  

Quelle  GlibContext.java

  Sprache: JAVA
 

/*
 * Copyright (c) 2024 Florian "sp1rit" <sp1rit@disroot.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */


package org.gtk.android;

import static java.lang.annotation.ElementType.CONSTRUCTOR;
import static java.lang.annotation.ElementType.METHOD;

import androidx.annotation.UiThread;

import java.lang.annotation.Target;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Supplier;

public final class GlibContext {
 @Target({METHOD, CONSTRUCTOR})
 public @interface GtkThread {}

 private GlibContext() {}

 public static native void runOnMain(Runnable runnable);

 @UiThread
 public static <T> T blockForMain(Supplier<T> runnable) {
  CountDownLatch barrier = new CountDownLatch(1);
  AtomicReference<T> retval = new AtomicReference<>();
  runOnMain(() -> {
   retval.set(runnable.get());
   barrier.countDown();
  });
  try {
   barrier.await();
  } catch (InterruptedException e) {
   // I don't think this can ever be thrown.
   throw new RuntimeException(e);
  }
  return retval.get();
 }

 @UiThread
 public static void blockForMain(Runnable runnable) {
  blockForMain(() -> {
   runnable.run();
   return null;
  });
 }
}

Messung V0.5 in Prozent
C=100 H=98 G=98

¤ Dauer der Verarbeitung: 0.11 Sekunden  (vorverarbeitet am  2026-07-02) ¤

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