Skip to content

Commit fb28cbf

Browse files
committed
Add ability to wait a job handle
1 parent cd9e1bd commit fb28cbf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

JobScheduler/JobHandle.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Diagnostics;
2+
using Schedulers.Utils;
23

34
namespace Schedulers;
45

@@ -243,6 +244,16 @@ public void SetDependsOn(JobHandle source)
243244
source.AddDependent(this);
244245
}
245246

247+
/// <summary>
248+
/// A shortcut to <see cref="JobScheduler.Flush(JobHandle)"/>.
249+
/// Calls the global scheduler wait the job.
250+
/// In case you want to use other scheduler then use <see cref="JobScheduler.Wait(JobHandle)"/> instead.
251+
/// </summary>
252+
public void Wait()
253+
{
254+
ParallelForJobCommon.GlobalScheduler!.Wait(this);
255+
}
256+
246257
/// <summary>
247258
/// Dependent handles are added to the current <see cref="JobHandle"/> to be executed after it.
248259
/// If the list of dependents is full, it will act as a linked list and create another node to store the additional dependents.

0 commit comments

Comments
 (0)