void Scheduler::sleepAndRelease ( SpinLock &lock ) { lockScheduling(); currentThread->state_=Sleeping; lock.release(); unlockScheduling(); yield(); }
Font Font::getDefault() { static Font font; static SpinLock lock; lock.lock(); if (font.getHandle() == nullptr) { jni::Class Button("libnative/ui/TextComponent"); jni::method_t viewConstructor = Button.getConstructor("(Landroid/content/Context;)V"); jni::Object button = Button.newInstance(viewConstructor, (jni::Object*) App::getAppHandle()); // Android already scales its default fonts. font._size = button.call<float>("getScaledTextSize"); font._shared->handle = new jni::Object(button.call<jni::Object>("getTypeface()Landroid/graphics/Typeface;")); } lock.release(); return font; }