/// <summary>
		///		Wait for the <see cref="ManualResetEvent"/> to enter the signaled state.
		/// </summary>
		/// <param name="waitHandle">
		///		The <see cref="ManualResetEvent"/>.
		/// </param>
		/// <param name="cancellationToken">
		///		A <see cref="CancellationToken"/> that can be used to cancel the wait operation.
		/// </param>
		/// <returns>
		///		<c>true</c>, if the <see cref="ManualResetEvent"/> enters the signaled state before the <see cref="CancellationToken"/> is cancelled; otherwise, <c>false</c>.
		/// </returns>
		public static bool WaitOne(this ManualResetEvent waitHandle, CancellationToken cancellationToken)
		{
			if (waitHandle == null)
				throw new ArgumentNullException(nameof(waitHandle));

			using (ManualResetEvent timeout = new ManualResetEvent(false))
			{
				timeout.SetIfCancelled(cancellationToken);

                try
				{
					WaitHandle[] bothWaitHandles =
					{
						timeout,
						waitHandle
					};

					return WaitHandle.WaitAny(bothWaitHandles) == 1;
				}
				catch (TimeoutException)
				{
					return false;
				}
			}
		}