Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ public static void init(@NotNull final SentryAndroidOptions options) {

/** Closes the NDK integration */
public static void close() {
shutdown();
try {
if (loadLibraryLatch.await(2000, TimeUnit.MILLISECONDS)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this could slow down on SDK restart/double init
i'd rather submit the shutdown() to the same thread we use to load the libraries
wdyt?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thinks it's fine this way because .init() already waits for the latch to finish, so whenever .close() is called the latch is already counted down. So even a double init wouldn't cause this to be blocking, unless you call SentryAndroid.init() from different threads in parallel 😅
So the .await() will only be blocking in case SentryNdk.close() is called before SentryNdk.init() - in theory this should never happen.

shutdown();
} else {
throw new IllegalStateException("Timeout waiting for Sentry NDK library to load");
}
} catch (InterruptedException e) {
throw new IllegalStateException(
"Thread interrupted while waiting for NDK libs to be loaded", e);
}
}
}
Loading