相关疑难解决方法(0)

具有多个参数的线程

有谁知道如何将多个参数传递给Thread.Start例程?

我想扩展类,但C#Thread类是密封的.

以下是我认为代码的样子:

...
    Thread standardTCPServerThread = new Thread(startSocketServerAsThread);

    standardServerThread.Start( orchestrator, initializeMemberBalance, arg, 60000);
...
}

static void startSocketServerAsThread(ServiceOrchestrator orchestrator, List<int> memberBalances, string arg, int port)
{
  startSocketServer(orchestrator, memberBalances, arg, port);
}
Run Code Online (Sandbox Code Playgroud)

顺便说一下,我用不同的协调器,天平和端口启动了许多线程.请考虑线程安全.

.net c# parameters multithreading thread-safety

37
推荐指数
6
解决办法
8万
查看次数

标签 统计

.net ×1

c# ×1

multithreading ×1

parameters ×1

thread-safety ×1