-
-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implements avrt #324
Closed
Closed
implements avrt #324
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c7700d4
add a macro to allow negative value in enums
k-brac 78c5fb0
implements avrt
k-brac 000e6c0
add assert to test
k-brac 04ad047
build test only for msvc
k-brac 1813880
add libavrt.a from cygwin for -gnu target
k-brac 3b7ba66
removed enum AVRT_NOTIFICATION (has been deleted from windows 10 SDK)
k-brac File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,60 @@ | ||
// Copyright © 2015, Peter Atashian | ||
// Licensed under the MIT License <LICENSE.md> | ||
//! FFI bindings to avrt. | ||
#![no_std] | ||
#![experimental] | ||
#![cfg(windows)] | ||
extern crate winapi; | ||
use winapi::*; | ||
|
||
extern "system" { | ||
pub fn AvSetMmThreadCharacteristicsA( | ||
TaskName: winapi::LPCSTR, TaskIndex: winapi::LPDWORD | ||
) -> winapi::HANDLE; | ||
|
||
pub fn AvSetMmThreadCharacteristicsW( | ||
TaskName: winapi::LPCSTR, TaskIndex: winapi::LPDWORD | ||
) -> winapi::HANDLE; | ||
|
||
pub fn AvSetMmMaxThreadCharacteristicsA ( | ||
FirstTask: winapi::LPCSTR, SecondTask: winapi::LPCSTR, TaskIndex: winapi::LPDWORD | ||
) -> winapi::HANDLE; | ||
|
||
pub fn AvSetMmMaxThreadCharacteristicsW ( | ||
FirstTask: winapi::LPCWSTR, SecondTask: winapi::LPCWSTR, TaskIndex: winapi::LPDWORD | ||
) -> winapi::HANDLE; | ||
|
||
pub fn AvRevertMmThreadCharacteristics(avrt_handle: winapi::HANDLE) -> winapi::BOOL; | ||
|
||
pub fn AvSetMmThreadPriority ( | ||
AvrtHandle: winapi::HANDLE, Priority: winapi::AVRT_PRIORITY) -> winapi::BOOL; | ||
|
||
pub fn AvRtCreateThreadOrderingGroup ( | ||
Context: winapi::PHANDLE, Period: winapi::PLARGE_INTEGER, | ||
ThreadOrderingGuid: * mut winapi::GUID, Timeout: winapi::PLARGE_INTEGER | ||
) -> winapi::BOOL; | ||
|
||
pub fn AvRtCreateThreadOrderingGroupExA ( | ||
Context: winapi::PHANDLE, Period: winapi::PLARGE_INTEGER, | ||
ThreadOrderingGuid: * mut winapi::GUID, Timeout: winapi::PLARGE_INTEGER, | ||
TaskName: winapi::LPCSTR | ||
) -> winapi::BOOL; | ||
|
||
pub fn AvRtCreateThreadOrderingGroupExW ( | ||
Context: winapi::PHANDLE, Period: winapi::PLARGE_INTEGER, | ||
ThreadOrderingGuid: * mut winapi::GUID, Timeout: winapi::PLARGE_INTEGER, | ||
TaskName: winapi::LPCWSTR | ||
) -> winapi::BOOL; | ||
|
||
pub fn AvRtJoinThreadOrderingGroup ( | ||
Context: winapi::PHANDLE, ThreadOrderingGuid: * mut winapi::GUID, | ||
Before: winapi::BOOL | ||
) -> winapi::BOOL; | ||
|
||
pub fn AvRtWaitOnThreadOrderingGroup (Context: winapi::HANDLE) -> winapi::BOOL; | ||
|
||
pub fn AvRtLeaveThreadOrderingGroup (Context: winapi::HANDLE) -> winapi::BOOL; | ||
|
||
pub fn AvRtDeleteThreadOrderingGroup (Context: winapi::HANDLE) -> winapi::BOOL; | ||
|
||
pub fn AvQuerySystemResponsiveness ( | ||
AvrtHandle: winapi::HANDLE, SystemResponsivenessValue: winapi::PULONG | ||
) -> winapi::BOOL; | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright © 2016, Baptiste AUBRY | ||
// Licensed under the MIT License <LICENSE.md> | ||
|
||
ENUM_NEG!{enum AVRT_PRIORITY { | ||
AVRT_PRIORITY_VERYLOW = -2, | ||
AVRT_PRIORITY_LOW, | ||
AVRT_PRIORITY_NORMAL, | ||
AVRT_PRIORITY_HIGH, | ||
AVRT_PRIORITY_CRITICAL, | ||
}} | ||
|
||
ENUM!{enum AVRT_NOTIFICATION { | ||
AVRT_PROCESS_SUSPEND = 0, | ||
AVRT_PROCESS_RESUME, | ||
}} | ||
|
||
pub const THREAD_ORDER_GROUP_INFINITE_TIMEOUT: ::LONGLONG = -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright © 2016, Baptiste AUBRY | ||
// Licensed under the MIT License <LICENSE.md> | ||
#![cfg(windows)] | ||
extern crate avrt; | ||
extern crate winapi; | ||
|
||
use avrt::*; | ||
|
||
#[inline(never)] fn bb<T>(_: T) {} | ||
#[test] #[cfg(target_env = "msvc")] | ||
fn functions() { | ||
bb(AvSetMmThreadCharacteristicsA); | ||
bb(AvSetMmThreadCharacteristicsW); | ||
bb(AvSetMmMaxThreadCharacteristicsA); | ||
bb(AvSetMmMaxThreadCharacteristicsW); | ||
bb(AvRevertMmThreadCharacteristics); | ||
bb(AvRtCreateThreadOrderingGroup); | ||
bb(AvRtCreateThreadOrderingGroupExA); | ||
bb(AvRtCreateThreadOrderingGroupExW); | ||
bb(AvRtJoinThreadOrderingGroup); | ||
bb(AvRtWaitOnThreadOrderingGroup); | ||
bb(AvRtLeaveThreadOrderingGroup); | ||
bb(AvRtDeleteThreadOrderingGroup); | ||
bb(AvQuerySystemResponsiveness); | ||
|
||
assert_eq!(winapi::THREAD_ORDER_GROUP_INFINITE_TIMEOUT, -1); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strangely enough,
AVRT_NOTIFICATION
was actually removed in the Windows 10 SDK. Since I try to track the latest Windows 10 SDK with winapi, I'd rather this not be here, unless you can provide a compelling reason for why it should be kept.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. My visual studio was not properly setup to use the latest sdk... Hence I removed AVRT_NOTIFICATION
The rest doesn't seem to have been modified