Description: 在wxWidgets的框架下,如何wxCondition類別實作近似於Win32 WaitForSingleObject的功能.-This src demonstrates how to implement a "Win32 WaitForSingleObject like" function using wxCondition class (in wxWidgets framework) Platform: |
Size: 7858176 |
Author:cckuo0509 |
Hits:
Description: 创建进程
文件包含在linux和windows下创建进程的算法
设计并实现Unix的“time”命令。“mytime”命令通过命令行参数接受要运行的程序,创建一个独立的进程来运行该程序,并记录程序运行的时间。
在Windows下实现:
• 使用CreateProcess()来创建进程
• 使用WaitForSingleObject()在“mytime”命令和新创建的进程之间同步
• 调用GetSystemTime()来获取时间
在Linux下实现:
• 使用fork()/execv()来创建进程运行程序
• 使用wait()等待新创建的进程结束
• 调用gettimeofday()来获取时间
-Create process
File contains under the Windows in the process of creating and Linux algorithm
Design and implement the "time" Unix commands. "Mytime" command through the command line parameters to accept applications, creating a separate process to run this program, and record the process of running time.
Under Windows:
CreateProcess (), use to create process
Use WaitForSingleObject (), in the "new" command and mytime process of creating between synchronization
GetSystemTime (), call for time
To realize the Linux in:
Use fork (,)/execv () to create a process to run the program
Using pro (), waiting for a new process of creating
Gettimeofday (), calls for time Platform: |
Size: 1342464 |
Author:得分 |
Hits:
Description: 事件的使用实例。主要示例了CreateEvent、SetEvent、ResetEvent、WaitForSingleObject函数的使用。-Events use cases. Major example of the CreateEvent, SetEvent, ResetEvent, WaitForSingleObject function to use. Platform: |
Size: 26624 |
Author:zhangzl |
Hits:
Description: 通过windows的内核对象JobObject实现对程序的运行时间和内存使用的控制,开发初衷是作为一个简陋的acm判题沙箱.
大致步骤:
1.通过CreateJobObject创建一个工作对象
2.通过SetInformationJobObject设置工作对象的参数,详见MSDN(http://msdn.microsoft.com/zh-cn/library/ms686216)
3.以CREATE_SUSPENDED方式启动进程,通过CreateProcessAsUser或者CreateProcess函数,可能还有其他函数,未做研究.
4.通过AssignProcessToJobObject将工作对象应用到指定进程中.
5.通过ResumeThread恢复已暂停的进程.
6.通过WaitForSingleObject等待正在运行的工作对象,设置好允许使用时间.
7.通过QueryInformationJobObject获取工作对象的最终状态.运行程序的退出状态可以通过GetExitCodeProcess获取.
8.扫尾工作(必须使用TerminateJobObject结束当前的工作对象,因为工作对象即便设置了PerProcessUserTimeLimit也无法使程序在超时后退出,没有研究原因).
编译时请包含Kernel32.lib.-By the windows kernel objects JobObject control program run time and memory usage, originally developed as a rudimentary the acm sentenced Title sandbox. Roughly steps: 1. Through CreateJobObject create a work object 2. Through SetInformationJobObject set object parameters, see the MSDN (http://msdn.microsoft.com/zh-cn/library/ms686216) start the process to CREATE_SUSPENDED way through CreateProcessAsUser or CreateProcess function, may have other functions, without making research. by AssignProcessToJobObject work object applied to the specified process. 5. through ResumeThread recovery process has been suspended. 6. WaitForSingleObject to wait for running work object, set up to allow the use of time. through QueryInformationJobObject get the final state of the work objects run the program exit the state by GetExitCodeProcess get off the work (must use TerminateJobObject the end of the current work object, because the work object even set PerProcessUserTimeLimit can not make the prog Platform: |
Size: 1024 |
Author: |
Hits: