예제 #1
0
파일: UvCheck.cs 프로젝트: codecopy/NLibuv
        /// <summary>
        /// Initializes a new instance of the <see cref="UvCheck"/> handle.
        /// </summary>
        /// <param name="loop">Loop, on which this handle will be initialized.</param>
        /// <param name="callback">Callback, which will be invoked every loop iteration.</param>
        /// <param name="state">A state object to be stored in the handle for later use inside the callback.</param>
        public UvCheck(UvLoop loop, Action <UvCheck> callback, object state = null)
            : base(loop, UvHandleType.Check)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            this._Callback = callback;
            this._State    = state;
            Libuv.EnsureSuccess(Libuv.uv_check_init(loop, this));
            this.NeedsToBeClosed = true;
        }