mirror of
https://github.com/GTA-ASM/SanAndreasUnity
synced 2025-02-16 21:08:28 +00:00
more safeguards
This commit is contained in:
parent
32c3504a27
commit
31a1a7a0a5
1 changed files with 9 additions and 2 deletions
|
@ -175,7 +175,14 @@ namespace SanAndreasUnity.Behaviours
|
|||
}
|
||||
|
||||
|
||||
public static void RegisterJob<T> (Job<T> job)
|
||||
public static void RegisterJob<T>(Job<T> job)
|
||||
{
|
||||
ThreadHelper.ThrowIfNotOnMainThread(); // obtaining Singleton should only happen on main thread
|
||||
|
||||
Singleton.RegisterJobOnInstance(job);
|
||||
}
|
||||
|
||||
public void RegisterJobOnInstance<T> (Job<T> job)
|
||||
{
|
||||
// note: this function can be called from any thread
|
||||
|
||||
|
@ -198,7 +205,7 @@ namespace SanAndreasUnity.Behaviours
|
|||
if(job.callbackFinish != null)
|
||||
j.callbackFinish = (arg) => job.callbackFinish( (T) arg );
|
||||
|
||||
Singleton._threadParameters.jobs.Add (j);
|
||||
_threadParameters.jobs.Add (j);
|
||||
}
|
||||
|
||||
static long GetNextJobId()
|
||||
|
|
Loading…
Add table
Reference in a new issue