Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lock (ClientLocker)
- {
- Trace.WriteLine("#WriteAll: " + sm.Header);
- foreach (Client c in Clients)
- {
- if (c.LoggedIn)
- {
- Trace.WriteLine("#TryWriteTo[" + c.Id + "](" + sm.Header + ")");
- LazyAsync.Invoke(() => c.WriteMessage(sm));
- }
- }
- }
- public static class LazyAsync
- {
- public static void Invoke(Action a)
- {
- a.BeginInvoke(a.EndInvoke, null);
- }
- }
- lock (ClientLocker)
- {
- Trace.WriteLine("#WriteAll: " + sm.Header);
- foreach (Client c in Clients)
- {
- if (c.LoggedIn)
- {
- Client localC = c;
- Trace.WriteLine("#TryWriteTo[" + c.Id + "](" + sm.Header + ")");
- LazyAsync.Invoke(() => localC.WriteMessage(sm));
- }
- }
- }
- lock (ClientLocker)
- {
- Trace.WriteLine("#WriteAll: " + sm.Header);
- foreach (Client c in Clients)
- {
- if (c.LoggedIn)
- {
- Trace.WriteLine("#TryWriteTo[" + c.Id + "](" + sm.Header + ")");
- Client copyOfC = c;
- LazyAsync.Invoke(() => copyOfC.WriteMessage(sm));
- }
- }
- }
- foreach (Client c in Clients)
- {
- if (c.LoggedIn)
- {
- Trace.WriteLine("#TryWriteTo[" + c.Id + "](" + sm.Header + ")");
- Client client = c;
- LazyAsync.Invoke(() => client.WriteMessage(sm));
- }
- }
Add Comment
Please, Sign In to add comment