private static void QueueFinishGraphInMainThread(Graph graph)
        {
            if (_acceptingWork == false)
            {
                return;
            }

            GraphFinishTemplate template = new GraphFinishTemplate(graph);

            template.SetCallBack(() => {
                graph.SetAsCanBeUsed();
                SetGraph(graph);
                _activeCreationWorks--;
                //decrease thread count in very end and in main thread
                _allTemplatesCreative.Remove(new GeneralXZData(graph.gridPosition, graph.properties));
                if (_settings.useMultithread)
                {
                    _activeThreads--;
                }
            });

            _allTemplatesCreative[new GeneralXZData(graph.gridPosition, graph.properties)] = template;

            lock (_connectionQueue)
                _connectionQueue.Enqueue(template);
        }
        private static IEnumerator ChunkConnection()
        {
            GraphFinishTemplate f_t = null;

            while (true)
            {
                //if (_disconnectionQueue.Count > 0)
                //    Debug.Log("GraphFinishTemplate blocked by _disconnectionQueue.Count > 0");

                if (_acceptingWork == false | _disconnectionQueue.Count > 0)
                {
                    goto next;
                }

                lock (_connectionQueue)
                    f_t = _connectionQueue.Count > 0 ? _connectionQueue.Dequeue() : null;

                if (f_t == null)
                {
                    goto next;
                }

                f_t.Work();

                //Debug.LogFormat("taken {0}, now active creation is {1}", "GraphFinishTemplate", _activeCreationWorks);
                goto next;

next:
                {
                    yield return(new WaitForEndOfFrame());

                    continue;
                }
            }
        }