后台线程与UI线程 [英] Background thread vs UI thread

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

问题描述

任何人都可以帮助我弄清楚C#中的后台线程和UI线程吗.我用谷歌搜索了一下,但是我找不到文章对此进行了说明.

Could any one help me to figure out background thread and UI thread in C#.I have googled it but i coudnt find article illustrate both.

推荐答案

UI线程创建UI元素,并等待并响应鼠标单击和按键之类的事件.您只能从UI线程访问UI元素.

A UI thread creates UI elements and waits and responds to events like mouse clicks and key presses. You can only access the UI elements from the UI thread.

有两种类型的线程:背景和前景. UI线程是前景线程的示例.

There are two types of threads: background and foreground. A UI thread is an example of a foreground thread.

后台线程和前台线程之间的区别非常简单.后台线程不会阻止进程终止,但是前台线程会终止.当最后一个前台线程停止时,所有后台线程也将停止,并且该过程结束.

The difference between background and foreground threads is pretty simple. Background threads don't stop a process from terminating, but foreground threads do. When the last foreground thread stops, then all the background threads are also stopped and the process ends.

这篇关于后台线程与UI线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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