/*
 *  Copyright (c) Facebook, Inc. and its affiliates.
 *
 *  This source code is licensed under the MIT license found in the LICENSE
 *  file in the root directory of this source tree.
 *
 */
package com.facebook.yoga;

import com.facebook.soloader.SoLoader;

public class YogaJNI {

  // Known constants. 1-3 used in previous experiments. Do not reuse.
  public static int JNI_FAST_CALLS = 4;

  // set before loading any other Yoga code
  public static boolean useFastCall = false;

  private static native void jni_bindNativeMethods(boolean useFastCall);

  static boolean init() {
    if (SoLoader.loadLibrary("yoga")) {
      jni_bindNativeMethods(useFastCall);
      return true;
    }

    return false;
  }
}

@@ -277,16 +277,64 @@
 ogaJNI %7B
+%0A  private static boolean isInitialized = false;
 %0A%0A  // K
@@ -603,32 +603,45 @@
 all);%0A%0A  static 
+synchronized 
 boolean init() %7B
@@ -649,16 +649,68 @@
     if (
+!isInitialized) %7B%0A      isInitialized = true;%0A      
 SoLoader
@@ -729,19 +729,17 @@
 (%22yoga%22)
-) %7B
+;
 %0A      j
@@ -796,15 +796,14 @@
 ue;%0A
+
     %7D%0A
-%0A
     

Add Yoga JNI bindings to libcoldstart