/// <summary>
 /// Initializes a new instance of the <see cref="WorkQueue"/> class.
 /// </summary>
 /// <param name="parent">The parent SynchronizationContext.</param>
 /// <param name="cancellationToken">A cancellation token.</param>
 public WorkQueue(PlatformSynchronizationContext parent, CancellationToken cancellationToken)
 {
     this.parent            = parent;
     this.cancellationToken = cancellationToken;
     this.thread            = new Thread(this.ProcessQueue);
     this.thread.Start();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PlatformDispatcher"/> class.
 /// </summary>
 /// <param name="cancellationToken">The cancellation token to pass to the synchronizationcontext.</param>
 public PlatformDispatcher(CancellationToken cancellationToken)
 {
     this.context = new PlatformSynchronizationContext(cancellationToken);
     this.context.UnhandledException += (sender, e) =>
     {
         this.OnUnhandledException(new UnhandledExceptionEventArgs(e, false));
     };
 }