Example #1
0
        internal LoopWork(Loop loop, Action run, Action after, Action <LoopWork> completed)
        {
            _run         = new uv_work_cb(this.Run);
            _after       = new uv_after_work_cb(this.After);
            _runAction   = run;
            _afterAction = after;
            _completed   = completed;
            _loop        = loop;
            _work        = _loop.Requests.Create(uv_req_type.UV_WORK);

            try
            {
                _loop.CheckError(Uvi.uv_queue_work(_loop.Handle, _work, _run, _after));
            }
            catch (Exception)
            {
                _work = _loop.Requests.Delete(_work);
                throw;
            }
        }