[vm] Sync ffi callbacks can enter owned target isolate
Adds a new code path for NativeCallable.isolateLocal invocations. If the current thread is not entered into any isolate, but owns the target isolate, then it enters the target isolate, invokes, then exits the isolate. Fixes: https://github.com/dart-lang/sdk/issues/61623 TEST=tests/ffi/function_callbacks_isolate_ownership_test.dart Change-Id: I401f185fadf7d2a55190dafd15387e1c418c67c9 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452380 Reviewed-by: Ryan Macnak <rmacnak@google.com> Commit-Queue: Liam Appelbe <liama@google.com>
This commit is contained in:
committed by
Commit Queue
parent
61babf9699
commit
4679c040c6
@@ -2232,6 +2232,16 @@ DART_EXPORT void Dart_SetCurrentThreadOwnsIsolate() {
|
||||
}
|
||||
}
|
||||
|
||||
DART_EXPORT void Dart_ClearCurrentThreadOwnsIsolate_ForTesting() {
|
||||
Isolate* isolate = Isolate::Current();
|
||||
CHECK_ISOLATE(isolate);
|
||||
if (!isolate->SetOwnerThread(OSThread::GetCurrentThreadId(),
|
||||
OSThread::kInvalidThreadId)) {
|
||||
FATAL("Tried to clear ownership of isolate %s, but we don't own it\n",
|
||||
isolate->name());
|
||||
}
|
||||
}
|
||||
|
||||
DART_EXPORT bool Dart_GetCurrentThreadOwnsIsolate(Dart_Port port) {
|
||||
return PortMap::IsOwnedByCurrentThread(port);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user