Timers Question

05/07/2013 21:24 hacksaw#1
I've been using the following code for specific events to activate things at different times for everyone who is in the event which works fine.
But now im looking at using for something different and im wondering if there is a way to make it so that for every new player that goes through this it starts a new "TimerB" for each individual player rather than just altering it for every player thats gone through it?

Code:
public static System.Timers.Timer TimerB;

       public static void Start(Client.GameState client)
         {
            TimerB = new System.Timers.Timer(1000.0);
            TimerB.Start();
            TimerB.Elapsed += delegate { Create(client); };
Code:
       public static void Create(Client.GameState client)
         {
           if (Now > CreateStamp.AddMinutes(5))
            {
            TimerB.Stop();
            Trigger1(client);
               }
           }
05/07/2013 21:49 Super Aids#2
Why not just make a thread that handles this and loops through your collection of players?

That way you have a single thread and wouldn't have to worry too much about multiple threads, cross-threading etc. assuming your client-collection is thread-safe.