创建线程 [英] Creating of Thread

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

问题描述

让我说我有带按钮的Windows窗体.并为每次单击创建新线程.线程是孤立的内存和平.因此,在加载表单时,将在主线程中创建表单对象.现在,当按下按钮时-创建新线程.这意味着将为此线程分配新的隔离内存区域.
我的问题是:这个新线程还将包含表单对象还是包含对表单的引用?如果是,那么操作系统知道如何在创建新线程时在其窗体对象中创建它.如果我错了,那么在新线程中创建了什么?

希望我能正确解释我的问题.

非常感谢您

Let say I have windows form with button. And for each click new thread is created. Thread is isolated peace of memory. So, when the form is loaded, the form object is created in the main thread. Now, when the button is pressed - new thread is created. This means that new isolated memory area is allocated for this thread.
My question is: does this new thread will also contain form object or will contain reference to the form? If yes, so how, OS knows that when new thread is created it has to created in it form object. If I''m wrong, so what is created in the new thread?

I hope, I explained correctly my question.

Thank you very much

推荐答案

您可能会喜欢这篇Multi Threading文章.

http://www.yoda.arachsys.com/csharp/threads [
You could have this Multi Threading article to be useful.

http://www.yoda.arachsys.com/csharp/threads[^]

Please vote and Accept Answer if it Helped.


因此,创建的所有线程都将共享表单对象,对吗?每个线程仅负责执行不同的功能.

我说的对吗?
So, all threads that are created will share the form object, right? Each thread will only be responsible for different functions to execute.

Am I right?


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

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