在c#代码中创建多线程? [英] Create multi threading in c# code ?

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

问题描述

hi


i我在smpp应用程序中使用函数发送短信

i使用forloop从表队列中获取数据

mu问题我的函数无法发送所有消息

如何创建多线程以在多线程中使用此函数(sendsms())

以便发送多个消息同时????





请帮帮我:)

解决方案

在C#中查找ConcurrentQueue。

我最近使用它并为你处理线程。


使用单独的线程是个好主意。最好使用单独的线程进行任何通信和类似的场景,你需要时间来完成一些动作,结果可以成功与否,等等。



但该怎么办呢?我不知道你有什么问题。您只需先学习线程,花费不错的时间,具体取决于您当前的水平。你可以从这里开始: https://msdn.microsoft.com/en -us / library / 3e8s7xdd%28v = vs.110%29.aspx [ ^ ]。



-SA

hi
i am using function to send sms in my smpp application
i use forloop to get data from table queue
mu issue that my function unable to send all msgs
how can i create multi threading to use this function ( sendsms() ) in multi threading
in order to send multi msgs at same time ????


please help me :)

解决方案

Look up ConcurrentQueue in C#.
I used it recently and it handles the threads for you.


Using a separate thread is a good idea. It's a good idea to use a separate thread to any communication and similar scenarios where you need time to complete some actions, the result can be successful or not, and so on.

But what to do about it? I don't know what issues you have. You just need to learn threading first, spend decent time, depending on your current level. You can start here: https://msdn.microsoft.com/en-us/library/3e8s7xdd%28v=vs.110%29.aspx[^].

—SA


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

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