滚动一个ConsoleApplication的滚动挂起线程 [英] Scrolling the scrollbar of a ConsoleApplication hangs the thread

查看:96
本文介绍了滚动一个ConsoleApplication的滚动挂起线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,我一直在试图从这样我就可以调试它们一些度量某些服务器应用程序。我发现,滚动时备份窗口,我突然得到来自客户端超时。果然,移动滚动条停止的应用程序。

I've got some server apps that I've been trying to get some metrics from so I can debug them. I found that when scrolling back up the window I'd suddenly get timeouts from the clients. Sure enough, moving the scrollbar stopped the application.

我可能失去了一些东西基波在这里,但我不明白为什么移动滚动条上的控制台窗口中会阻塞线程。

I'm probably missing something fundemental here, but I can't work out why moving the scrollbar on a Console window would block the thread.

这是非常简单的复制:

Sub Main()
    Do
        Console.WriteLine(Now.ToString("O"))
        System.Threading.Thread.Sleep(1000)
    Loop
End Sub

运行该起来,并用该窗口块的线程的任何相互作用。在下面的例子,我刚搬到滚动了一下,之前发布

Run that up, and any interaction with the window blocks the thread. In the example below, I just moved the scrollbar a bit and held it in position for a few seconds before releasing

http://www.briandrought.com/miscpics/scrollbar.png

http://www.briandrought.com/miscpics/scrollbar.png

我已经试过了一个定时器类型的循环,而不是一个Thread.sleep代码,但仍然出现同样的问题。什么我做错了(除了不使用的服务,而不是!)?

I've tried it with a Timer type loop rather than a Thread.Sleep but the same issue appears. What am I doing wrong (other than not using a service instead!)?

亲切的问候,

布莱恩

推荐答案

你没有做错什么。这就是Windows控制台应用程序是如何做人。在正常运行的服务器应用程序肯定会跑的无头服务,所以应该没有问题,在生产中。

You're not doing anything wrong. That's just how windows console apps behave. In normal operation your server apps would surely run as headless services so there should be no issue in production.

这篇关于滚动一个ConsoleApplication的滚动挂起线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆