Ejemplo n.º 1
0
        private static void FlattenSchemaThread()
        {
            while (true)
            {
                // Get the pending queue and reset the field.

                PendingFlatten pending;

                lock (_syncRoot)
                {
                    pending = _pendingFlatten;
                    _pendingFlatten = null;

                    // Quit if we don't have any work.

                    if (pending == null)
                    {
                        _flattenThreadRunning = false;
                        return;
                    }
                }

                // Process the queue.

                while (pending != null)
                {
                    pending.Schema.FlattenSchema();

                    pending = pending.Parent;
                }
            }
        }
Ejemplo n.º 2
0
        private static void QueueFlattenSchema(JsSchema schema)
        {
            bool startThread = false;

            // Push the schema onto the pending queue.

            lock (_syncRoot)
            {
                _pendingFlatten = new PendingFlatten(schema, _pendingFlatten);

                // If the thread isn't running, we need to start it.

                if (!_flattenThreadRunning)
                {
                    _flattenThreadRunning = true;
                    startThread = true;
                }
            }

            if (startThread)
                ThreadPool.QueueUserWorkItem(p => FlattenSchemaThread());
        }
Ejemplo n.º 3
0
 public PendingFlatten(JsSchema schema, PendingFlatten parent)
 {
     Schema = schema;
     Parent = parent;
 }