// Token: 0x06005897 RID: 22679 RVA: 0x001EB2C8 File Offset: 0x001E96C8 private void ThreadLoop() { while (this.alive) { try { VRCWorker.Job job = this.activeJobs.Dequeue(); object obj = job; lock (obj) { if (job != null) { job.Action(); this.finishedJobs.Enqueue(job); } } } catch (InvalidOperationException) { } catch (Exception exception) { Debug.LogException(exception); } Thread.Sleep(this.ThreadWait); } }
// Token: 0x06005896 RID: 22678 RVA: 0x001EB248 File Offset: 0x001E9648 private void Update() { try { VRCWorker.Job job = this.finishedJobs.Dequeue(); object obj = job; lock (obj) { if (job != null) { job.OnDone(); } } } catch (InvalidOperationException) { } catch (Exception exception) { Debug.LogException(exception); } }
// Token: 0x06005893 RID: 22675 RVA: 0x001EB09C File Offset: 0x001E949C public static VRCWorker.Job AddJob <OutcomeType>(Func <OutcomeType> workToDo, Action <OutcomeType> onDone) where OutcomeType : class { if (VRCWorker.Instance == null) { return(null); } VRCWorker.Job newJob = new VRCWorker.Job { Outcome = null, Completed = false }; newJob.Action = delegate { newJob.Outcome = workToDo(); }; newJob.OnDone = delegate { onDone((OutcomeType)((object)newJob.Outcome)); newJob.Completed = true; }; VRCWorker.Instance.activeJobs.Enqueue(newJob); return(newJob); }