예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UvPrepare"/> 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 UvPrepare(UvLoop loop, Action <UvPrepare> callback, object state)
            : base(loop, UvHandleType.Prepare)
        {
            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

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