Saving data in the process

Source: Internet
Author: User

Thread provides an API to save data to a thread, just as every thread in ASP. NET saves a session.
Use thread. getdata and setdata to read or write data. ExampleCodeAs follows:

Thread. setdata (thread. getnameddataslot ("key"), data );
Object Data = thread. getdata (thread. getnameddataslot ("key "));

 

Thread. getnameddataslot ("key") is used to obtain a named data slot. If this method is called for the first time, this name slot will be created first.

With the above method, each thread can read and write data in the data slot without causing conflicts. That is to say, the content read by two different threads is the content they write themselves. The second link in the following link mentions that the namedata slot can be released. In actual use, there is no need to release or cause memory leakage.

 

Related Links

Http://msdn.microsoft.com/zh-cn/library/6sby1byh%28v=VS.90%29.aspx
Http://hi.baidu.com/lhdisme/blog/item/69772bf841061c0ad9f9fde0.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.