Advertisement
Guest User

Untitled

a guest
Jul 31st, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.65 KB | None | 0 0
  1. private static List<Star> stars;
  2. ...
  3. public static void GetPlanetsInformation(int _starID)
  4.         {
  5.             if(WaitFor(ref stars, timeoutSec)) //ERROR
  6.                 netWorker.GetPlanetsInformation(_starID);
  7.         }
  8. private static bool WaitFor(ref object obj, int timeoutSec)
  9.         {
  10.             int times = 0;
  11.             int tick = 100;
  12.             while (obj == null)
  13.             {
  14.                 if (times < timeoutSec)
  15.                 {
  16.                     System.Threading.Thread.Sleep(tick);
  17.                     times += tick;
  18.                 }
  19.                 else return false;
  20.             }
  21.             return true;
  22.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement