Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static List<Star> stars;
- ...
- public static void GetPlanetsInformation(int _starID)
- {
- if(WaitFor(ref stars, timeoutSec)) //ERROR
- netWorker.GetPlanetsInformation(_starID);
- }
- private static bool WaitFor(ref object obj, int timeoutSec)
- {
- int times = 0;
- int tick = 100;
- while (obj == null)
- {
- if (times < timeoutSec)
- {
- System.Threading.Thread.Sleep(tick);
- times += tick;
- }
- else return false;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement