public void WaitEnd ()
{
if (!IsCompleted) {
// FIXME: Do we need to use the timeout? If so, what happens when the timeout is reached.
// Is the current request cancelled and an exception thrown? If so we need to pass the
// exception to the Complete () method and allow the result to complete 'normally'.
#if NET_2_1
// neither Moonlight nor MonoTouch supports contexts (WaitOne default to false)
bool result = AsyncWaitHandle.WaitOne (Timeout);
#else
bool result = AsyncWaitHandle.WaitOne (Timeout, true);
#endif
if (!result)
throw new TimeoutException ();
}
if (error != null)
throw error;
}