예제 #1
0
        public void TestReturnsResult()
        {
            var jobObjectHandle = IntPtr.Zero;

            try
            {
                jobObjectHandle = PInvokeUtils.Try(() => JobObjectAPI.CreateJobObject(IntPtr.Zero, null), result => result != IntPtr.Zero);

                Assert.AreNotEqual(jobObjectHandle, IntPtr.Zero);
            }
            finally
            {
                if (jobObjectHandle != IntPtr.Zero)
                {
                    JobObjectAPI.CloseHandle(jobObjectHandle);
                }
            }
        }
예제 #2
0
 /// <exception cref="Win32Exception">
 ///     Thrown if the operating system was unable to create a new Job Object.
 /// </exception>
 public JobObject()
 {
     _jobObjectHandle = PInvokeUtils.Try(() => JobObjectAPI.CreateJobObject(IntPtr.Zero, null));
 }