线程的全局变量 [英] Global variable for threading

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

问题描述

大家好,

我正在网站上进行简单的线程化,线程完成后我想返回线程函数返回的值,所以我想使用全局变量来存储它。然后我将从全局变量中获取值。我尝试了会话,cookie但值已重置因此使用静态但它保存了访问网站的多个用户的值是否有任何其他可能的全局变量用于单个用户具体?提前致谢。



我尝试过:



大家好,

我正在网站上进行简单的线程处理,线程完成后我想返回线程函数返回的值,所以我想使用全局变量来存储它。然后我将从全局变量中获取值。我尝试了会话,cookie但值已重置因此使用静态但它保存了访问网站的多个用户的值是否有任何其他可能的全局变量用于单个用户具体?提前谢谢。

解决方案

如果可以在客户端存储变量,可以使用本地存储,请参阅:

ASP.NET和HTML5本地存储Stephen Walther [ ^ ]

和: HTML5网络存储 [ ^ ]

这也将提高性能

hi guys,
I'm working on a simple threading in a website, after a thread is completed I want to return the values returned by thread function so I want to use global variables to store it. and later I'll get the values from the global variable.I tried session,cookies but values got reset So used static but it saves the values of multiple user accessing the website is there any other possibility of global variable to be used for single user specific?Thanks in advance.

What I have tried:

hi guys,
I'm working on a simple threading in a website, after a thread is completed I want to return the values returned by thread function so I want to use global variables to store it. and later I'll get the values from the global variable.I tried session,cookies but values got reset So used static but it saves the values of multiple user accessing the website is there any other possibility of global variable to be used for single user specific?Thanks in advance.

解决方案

If it is ok to store the variable on the Client side you could use local storage, see:
ASP.NET and HTML5 Local Storage | Stephen Walther[^]
and: HTML5 Web Storage[^]
This will also improve performance.


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

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