11b81715ad
Change-Id: I7b5e5dd768c87f28848ee02050582d23f3604cb1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426286 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Alexander Markov <alexmarkov@google.com> Auto-Submit: Bob Nystrom <rnystrom@google.com>
37 lines
1.1 KiB
Dart
37 lines
1.1 KiB
Dart
// Copyright (c) 2020, 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.
|
|
|
|
// VMOptions=--worker-thread-priority=-2
|
|
// A priority of -2 means THREAD_PRIORITY_LOWEST on windows
|
|
|
|
import 'dart:ffi';
|
|
import 'dart:io';
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
final DynamicLibrary kernel32 = DynamicLibrary.open("kernel32.dll");
|
|
|
|
// HANDLE GetCurrentThread();
|
|
typedef GetCurrentThreadFT = int Function();
|
|
typedef GetCurrentThreadNFT = IntPtr Function();
|
|
|
|
// int GetThreadPriority(HANDLE hThread);
|
|
typedef GetThreadPriorityFT = int Function(int handle);
|
|
typedef GetThreadPriorityNFT = Int32 Function(IntPtr handle);
|
|
|
|
final getCurrentThread = kernel32
|
|
.lookupFunction<GetCurrentThreadNFT, GetCurrentThreadFT>(
|
|
'GetCurrentThread',
|
|
);
|
|
final getThreadPriority = kernel32
|
|
.lookupFunction<GetThreadPriorityNFT, GetThreadPriorityFT>(
|
|
'GetThreadPriority',
|
|
);
|
|
|
|
main(args) {
|
|
if (Platform.isWindows) {
|
|
Expect.equals(-2, getThreadPriority(getCurrentThread()));
|
|
}
|
|
}
|