private void RequestThreadEntryPoint(object state)
        {
            RasterDataDetails details = (RasterDataDetails)state;

            details.WorkerWindow.Context.MakeCurrent();

            while (true)
            {
                TileLoadRequest request = null;
                lock (details.RequestList)
                {
                    LinkedListNode <TileLoadRequest> lastNode = details.RequestList.Last;
                    if (lastNode != null)
                    {
                        request = lastNode.Value;
                        details.RequestList.RemoveLast();
                    }
                    else
                    {
                        Monitor.Wait(details.RequestList);

                        lastNode = details.RequestList.Last;
                        if (lastNode != null)
                        {
                            request = lastNode.Value;
                            details.RequestList.RemoveLast();
                        }
                    }
                }

                if (request != null)
                {
                    RasterTile tile = request.Tile;
                    request.Texture = tile.LoadTexture();

                    Fence fence = Device.CreateFence();
                    fence.ClientWait();

                    details.DoneQueue.Post(request);
                }
            }
        }
        public void Process(object sender, MessageQueueEventArgs e)
        {
#if !SINGLE_THREADED
            _context.MakeCurrent();
#endif

            ShapefileRequest  request   = (ShapefileRequest)e.Message;
            ShapefileRenderer shapefile = new ShapefileRenderer(
                request.Filename, _context, _globeShape, request.Appearance);

#if !SINGLE_THREADED
            Fence fence = Device.CreateFence();
            while (fence.ClientWait(0) == ClientWaitResult.TimeoutExpired)
            {
                Thread.Sleep(10);   // Other work, etc.
            }
#endif

            _doneQueue.Post(shapefile);
        }