示例#1
0
        private void OnEnable()
        {
            //gameObject.hideFlags = HideFlags.HideAndDontSave;
            DontDestroyOnLoad(gameObject);

            firstUpdater = gameObject.AddComponent <FirstUpdaterBehaviour>();
            lastUpdater  = gameObject.AddComponent <LastUpdaterBehaviour>();

            SetupUpdaters();
            Debug.Log("Updater GameObject created and Updater Behaviours configured");

#if !UNITY_WEBGL || (!FORCE_WEBGL && UNITY_EDITOR)
            ThreadedJobs.MultithreadingStart();
            Debug.Log("Multithread Support started");
#endif
        }
示例#2
0
    public static void Main(string[] args)
    {
        updater = new Updater();
        ThreadedJobs.MultithreadingStart();

        updater.QueueCallback(() => { Console.WriteLine("Hi 1"); }, 1);
        updater.QueueCallback(() => { Console.WriteLine("Hi 2"); }, 2);
        updater.QueueCallback(() => { Console.WriteLine("Hi 3"); }, 3);
        updater.QueueCallback(() => { Console.WriteLine("Hi 4"); }, 4);

        //Program.Start();
        for (int i = 0; true; i++)
        {
            updater.Execute(null);
            Thread.Sleep(1);
        }
    }
示例#3
0
 static void B()
 {
     jobs[i] = ThreadedJobs.QueueMultithreadJob(DoSomething, null);
     i       = (i + 1) % BU.Length;
 }
示例#4
0
 private void OnDisable()
 {
     ThreadedJobs.MultithreadingEnd();
     Destroy(firstUpdater);
     Destroy(lastUpdater);
 }