forked from robotology/yarp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
At the current state, this objective-c++ file is used only to enable-disable AppNap. In the future it can be used for more macOS-only related activities Co-authored-by: Claudio Fantacci <claudio.fantacci@iit.it>
- Loading branch information
1 parent
4d17762
commit 4edc999
Showing
5 changed files
with
58 additions
and
0 deletions.
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
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,8 @@ | ||
#ifndef YARP_OS_MACOSAPI_H | ||
#define YARP_OS_MACOSAPI_H | ||
|
||
void* enableAppNap(); | ||
void disableAppNap(void *activityInfo); | ||
|
||
|
||
#endif /* end of include guard: YARP_OS_MACOSAPI_H */ |
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,19 @@ | ||
#import "yarp/os/impl/MacOSAPI.h" | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
void* enableAppNap() | ||
{ | ||
NSProcessInfo *processInfo = [NSProcessInfo processInfo]; | ||
id activity = [processInfo beginActivityWithOptions:NSActivityLatencyCritical | NSActivityUserInitiated | ||
reason:@"YARP requires AppNap off"]; | ||
return activity; | ||
} | ||
|
||
void disableAppNap(void *activityInfo) | ||
{ | ||
id activity = (id)activityInfo; | ||
if (!activity) return; | ||
NSProcessInfo *processInfo = [NSProcessInfo processInfo]; | ||
[processInfo endActivity:activity]; | ||
} |
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