如何暂停一个帖子? [英] How to suspend a thread?

查看:85
本文介绍了如何暂停一个帖子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在.Net 2.0框架中开发的winform应用程序,它调用webservices.Now我们通过我们的应用程序发送HTTP请求,每当接收HTTP响应超过3秒钟时,我启动一个显示处理图像的线程。现在收到HTTP响应后,我想中止线程或让它进入睡眠状态,直到我们需要发送另一个HTTP请求。我不是在处理图像线程上的睡眠方法,因为我在另一个线程。请帮助我解决这个问题。

解决方案

每当接收到HTTP响应超过3秒时,我就会启动一个显示处理图像的线程



请告诉我您的HTTP请求是在后台线程而不是用于显示此正在处理...消息的UI代码!?



WORK继续使用后台主题。 UI保留在UI(启动)线程上。



然后你不必担心中止一个除了建立UI之外什么都不做的线程。

I have a winform application developed in .Net 2.0 framework which calls webservices.Now we send HTTP request through our application and whenever it is taking more than 3 seconds for receiving HTTP response i start a thread which displays processing image.Now as soon as the HTTP response is received i want to abort the thread or put it to sleep until we need to send another HTTP request.I am not being sleep method on that processing image thread as i am in a different thread.Kindly please help me to get round this issue.

解决方案

whenever it is taking more than 3 seconds for receiving HTTP response i start a thread which displays processing image

PLEASE tell me your HTTP Request is on a background thread and not the UI code to display this "Processing..." message!?

The WORK goes on background threads. The UI stays on the UI (startup) thread.

Then you don't have to worry about aborting a thread that does nothing but putting up a UI.


这篇关于如何暂停一个帖子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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