1. Hey,

    So I am having issues with some of my plugins, specifically votechecker.

    The problem
    There are 2 webrequests, both can run or only 1 can run.
    The problem is the response time might be slow and the callback can yield a result slowly. I have a field called "timesVoted" and gets reset on GetRewardsForThisPlayer.

    Once GetRewardsForThisPlayer is called, it resets timesVoted to 0, and both webrequests callbacks could increment it with timesVoted+= votesFromRequest;.

    Problem now is, this will get passed by the first webrequest to come back, since they both are not returning at the exact same. How would I wait for both to return their results and then only proceed to give items.
     
  2. You would propably need to do what you want to wait for, in the callback of the webrequest.
     
  3. You could use CountdownEvent Class (System.Threading)

    If both request need to run you:
    var countdown = new CountdownEvent (2);
    Fire off both request:
    In each request have the callback signal the countdown:
    countdown.Signal();
    Have another thread kick off your vote update method and the first thing it will call is:
     
  4. This sounds exactly what I was looking for. Thank you
     
  5. Isn't System.Threading blocked?
     
  6. Yes, but the implementation of a CountdownEvent can be implemented by Pho3niX90.