阻止OSX休眠
2015-06-01 22:13
295 查看
#include <CoreServices/CoreServices.h> void MyTimerCallback(CFRunLoopTimerRef timer, void *info) { UpdateSystemActivity(OverallAct); } int main (int argc, const char * argv[]) { CFRunLoopTimerRef timer; CFRunLoopTimerContext context = { 0, NULL, NULL, NULL, NULL }; timer = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 30, 0, 0, MyTimerCallback, &context); if (timer != NULL); { CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopCommonModes); } /* Start the run loop to receive timer callbacks. You don't need to call this if you already have a Carbon or Cocoa EventLoop running. */ CFRunLoopRun(); CFRunLoopTimerInvalidate(timer); CFRelease(timer); return (0); }
相关文章推荐
- 长沙甲壳虫教育 留学
- Project Euler:Problem 23 Non-abundant sums
- 给定一个正整数数组,找所有元素组合起来最大的值(答案)
- 如何对IP地址进行排序?
- HDU 1004 Let the Balloon Rise (map使用)
- ViewConfiguration.getScaledTouchSlop () 用法
- C5.0算法学习
- Oracle之内存结构(SGA、PGA)
- 自己动手 CentOS-6.5 安装Oracle11g R2
- 堆排序
- office2010永久的密钥
- linux线程
- 第四章t7
- SSH 配置 简单留言板Demo
- JavaScript 对象
- 传智播客:复制多级文件夹
- 华为OJ之高级篇
- Oracle学习(10):其他数据库对象
- linux xshell的图形化支持
- Unity3D教程宝典之Shader篇 CG函数