Wait for an event to become signalled. Returns the value associated with the signalled event. The thread is suspended until the event becomes signalled. If the event has already been signalled at the time of the call to wait then the call returns the associated value immediately. As a convenience, event may be a thread, in which case the thread's termination event is used.