可继承线程中的概念 [英] A concept in inheritable threading

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

问题描述

我只想知道是否可以设置并获取线程中存在的值从另一个到另一个

在.net framework 3.5或更低版本中是否可能

i just want to know is it possible to set and get values that is being present in thread from one to another

Is it possible in .net framework 3.5 or below

Can you provide me some guidelines to implement it ?

推荐答案

答案还不清楚,但是也许您的意思是线程之间进行数据交换.为此,您需要了解线程同步原语:
http://msdn.microsoft.com/en-us/library/ms173179.aspx [ ^ ].

在我的方法中,最好的方法是通过线程包装器.请查看我过去的答案:
如何将ref参数传递给线程 [ ^ ],
启动后更改线程(生产者)的参数 [ ^ ].

转到第二个链接,了解如何将锁用于线程之间的数据交换以及线程包装器如何帮助封装此机制.

—SA
The answer is not clear, but perhaps you simply mean data exchange between threads; and to do that, you need to learn about thread synchronization primitives:
http://msdn.microsoft.com/en-us/library/ms173179.aspx[^].

In my approach, the best way to do it is through the thread wrapper. Please see my past answers:
How to pass ref parameter to the thread[^],
change paramters of thread (producer) after it started[^].

Go by a second link to see how lock is used for data exchange between threads and how the thread wrapper helps encapsulation of this mechanism.

—SA


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

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