IEnumerator buildMesh(Chunk c, Chunk.renderChunkDelegate callback)
    {
        /*
         #region CoroutineObject No Stacking
         * List<CoroutineObject> others = new List<CoroutineObject> (0);
         * foreach (GameObject g in GameObject.FindGameObjectsWithTag("CoroutineObject")) {
         *      if (g != this.gameObject) {
         *              others.Add(g.GetComponent<CoroutineObject>());
         *      }
         * }
         * bool needsToWait = true;
         * while(needsToWait) {
         *      int numRunning = 0;
         *      foreach(CoroutineObject co in others) {
         *              if(co.isRunning) {
         *                      numRunning++;
         *              }
         *      }
         *
         *      if(numRunning > maxNumRunning) {
         *              needsToWait = true;
         *      } else {
         *              needsToWait = false;
         *      }
         *
         *      if(needsToWait) {
         *              yield return null;
         *      }
         * }
         #endregion
         */

        isRunning = true;

        float time = 0.0f;

        ChunkMeshObject cmo    = null;
        bool            done   = false;
        Thread          thread = new Thread(() => {
            cmo  = ChunkMeshBuilder.BuildMesh(c);
            done = true;
        });

        thread.Start();

        while (!done && time < timeout)
        {
            yield return(new WaitForEndOfFrame());

            time += Time.deltaTime;
        }

        if (time >= timeout)
        {
            BuildMesh(c, callback);
            thread.Abort();
            print("CoroutineObject timed out building mesh. Retrying...");
            yield break;
        }
        callback.Invoke(cmo);
        Destroy(this.gameObject);
    }
 public void BuildMesh(Chunk c, Chunk.renderChunkDelegate callback)
 {
     StartCoroutine(buildMesh(c, callback));
 }