blob: 38411956bb0cc0530edc90531552dd13f8f1a9a8 [file] [log] [blame]
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// SharedObjects=ffi_test_functions
import 'dart:ffi';
import 'dart:isolate';
import 'dylib_utils.dart';
final ffiTestFunctions = dlopenPlatformSpecific("ffi_test_functions");
final initializeApi = ffiTestFunctions.lookupFunction<
IntPtr Function(Pointer<Void>),
int Function(Pointer<Void>)>("InitDartApiDL");
final enterBarrier =
ffiTestFunctions.lookupFunction<Void Function(IntPtr), void Function(int)>(
"WaitUntilNThreadsEnterBarrier");
main() async {
const threadBarrierCount = 30;
initializeApi(NativeApi.initializeApiDLData);
final all = <Future>[];
for (int i = 0; i < threadBarrierCount; ++i) {
all.add(Isolate.run(() => enterBarrier(threadBarrierCount)));
}
await Future.wait(all);
}