From c511a5dec1a018f42c92b36f7285864d9fe1c088 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Tue, 4 May 2021 11:40:44 +0200 Subject: [PATCH] Fix Threading issues (SV access from different Thread) (#1883) ## Description There are a few functions that check if you're currently on the REA UI Runtime by using `RuntimeDecorator::isWorkletRuntime`. This might actually lead to threading issues if you're calling those functions from another worklet runtime that is not from Reanimated (e.g. VisionCamera Frame Processors, Multithreading, ...) - so this PR fixes this. A few of those functions should actually check if they are specifically on the UI thread, Worklet thread is not enough. ## Changes - Add `RuntimeDecorator::isUIRuntime` - a function that specifically checks if the given `jsi::Runtime` is the REA UI Runtime as opposed to any Worklet Runtime - Replace a few `isWorkletRuntime` calls with `isUIRuntime`