Esempio n. 1
0
        public override void MakeRequest(I input, UnityAction <O> onJobDone)
        {
            var request = new CancelableRequest()
            {
                input = input, onJobDone = onJobDone
            };

            _requests.Enqueue(request);

            var jobInfo = new JobInfo {
                request = request, responses = _responses, job = _job
            };

            if (!_jobInfos.TryAdd(jobInfo.GetHashCode(), jobInfo))
            {
                Debug.LogError($"Failed to add Request in {GetType()}.");
            }

            var workerJob = new WorkerJob {
                workerId = GetHashCode(), jobId = jobInfo.GetHashCode()
            };

            workerJob.Schedule();
        }