c# - How to create multiple threads from an application and do not listen to their response? -
i trying following :
i have server supposed many messages queue , process them. want create new thread every message , threads handle response queue, want server (core thread) listening messages , creating threads, not caring of happens them.
how can achieve this? know can use thread
class create thread application keeps listening thread until if finishes. can create async
method , run happens when finishes? method supposed static if want async
in current application not solution since use many non static variables method.
any ideas appreciated.
unless have specific reason, i'd recommend using tasks instead of threads. they'll run in background anyway, produce less cpu/memory overhead , (in opinion) easier handle in case of exception,...
task t = task.run(() => processmessage(message));
maybe take @ this introduction
Comments
Post a Comment