Does anyone know how to pass multiple parameters into a Thread.Start routine?
I thought of extending the class, but the C# Thread class is sealed.
Here is what I think the code would look like:
...
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);
}
BTW, I start a number of threads with different orchestrators, balances and ports. Please consider thread safety also.
question from:
https://stackoverflow.com/questions/831009/thread-with-multiple-parameters 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…