/// <summary> /// Sets limits to the jhob. /// </summary> /// <param name="limits">The limits. May not be null.</param> public void SetLimits(JobObjectLimits limits) { if (limits == null) { throw new ArgumentNullException(nameof(limits)); } var info = JOBOBJECT_INFO.From(limits); var length = Environment.Is64BitProcess ? Marshal.SizeOf(info.ExtendedLimits64) : Marshal.SizeOf(info.ExtendedLimits32); if (!NativeMethods.SetInformationJobObject(this, JobObjectInfoClass.ExtendedLimitInformation, ref info, length)) { var err = Marshal.GetLastWin32Error(); throw new Win32Exception(err); } }
/// <summary> /// Sets limits to the job. /// </summary> /// <param name="limits">The limits. May not be null.</param> /// <returns> /// true if the function succeeds; otherwise false. /// </returns> public bool SetLimits(JobObjectLimits limits) { return(SetLimits(limits, throwOnError: false)); }