如何实现线程和处理并发请求 [英] How to implement threading and handle concurrent request

查看:71
本文介绍了如何实现线程和处理并发请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表对象,例如DBBL,BAL,SBL,LBF,BBL,...........这个列表对象有项目列表。我同时想要商店列表项目,例如当DBBL开始执行时,同时执行SBL等等,我认为线程是最好的方法,但不了解如何实现它。任何人都帮助我。



注意:

我想开发短信服务向持卡人广播短信对于许多银行。当交易发生时,短信会自动发送给持卡人。因此,应用程序需要将所有时间连接到银行服务器,以便同时获取每个银行的交易信息。为此我为每个银行创建了线程方法,因此一些事务通知没有发送。我想改进我的代码,然后如何做到这一点。

I have a list object e.g. "DBBL,BAL,SBL,LBF,BBL,..........." and this list object has list of item. I want store list item concurrently e.g. when DBBL start execution, same time execute SBL and so on, I think threading is the best way but don’t understand how to implement it. Anyone help me.

Note:
I want to develop a sms service to broadcast sms to card holder for many bank. When transaction is occurred then sms send to card holder automatically.For this reason application need to connect all time to bank server for getting transaction information for every bank concurrently. For this purpose i create thread method for every bank, as a result some transaction notification are not send.I want to improve my code, then how to do that.

推荐答案

当你使用C#时,任务可能是更好的解决方案!



看看这些文章:



任务并行库:n中的1个 [ ^ ]
When you are using C#, a task might be the better solution!

Look at these articles:

Task Parallel Library: 1 of n[^]


这篇关于如何实现线程和处理并发请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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