Skip to content

Instantly share code, notes, and snippets.

@chiepomme
Created October 21, 2013 11:28
Show Gist options
  • Save chiepomme/7082368 to your computer and use it in GitHub Desktop.
Save chiepomme/7082368 to your computer and use it in GitHub Desktop.
using SpicyPixel.Threading;
using SpicyPixel.Threading.Tasks;
using System.Collections;
public class SampleConcurrency : ConcurrentBehaviour
{
void Start()
{
print("Start Start");
taskFactory.StartNew(Bootstrap())
.ContinueWith(Mikostrap(), taskScheduler);
print("Start End");
}
IEnumerator Bootstrap()
{
print("Start BootStrap");
for (var i = 0; i < 100; i++)
{
yield return i;
print("BootStrap");
}
print("BootStrap End");
}
IEnumerator Mikostrap()
{
print("Start Mikopero");
for (var i = 0; i < 100; i++)
{
yield return i;
print("Mikopero");
}
print("Mikopero End");
}
}
using System.Collections;
using UnityEngine;
public class SampleCoroutine : MonoBehaviour
{
IEnumerator Start()
{
print("Start Start");
yield return StartCoroutine(Bootstrap());
yield return StartCoroutine(Mikostrap());
print("Start End");
}
IEnumerator Bootstrap()
{
print("Start BootStrap");
for (var i = 0; i < 100; i++)
{
yield return i;
print("BootStrap");
}
print("BootStrap End");
}
IEnumerator Mikostrap()
{
print("Start Mikopero");
for (var i = 0; i < 100; i++)
{
yield return i;
print("Mikopero");
}
print("Mikopero End");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment