/// <summary> /// Factory to create the action queue. /// </summary> /// <param name="spec">The action queue specification.</param> /// <param name="handler">The exception handler.</param> /// <returns>The action queue instance.</returns> public static MessageQueueThread Create( MessageQueueThreadSpec spec, Action <Exception> handler) { if (spec == null) { throw new ArgumentNullException(nameof(spec)); } if (handler == null) { throw new ArgumentNullException(nameof(handler)); } switch (spec.Kind) { case MessageQueueThreadKind.DispatcherThread: return(new DispatcherMessageQueueThread(spec.Name, handler)); case MessageQueueThreadKind.BackgroundSingleThread: return(new SingleBackgroundMessageQueueThread(spec.Name, handler)); case MessageQueueThreadKind.BackgroundAnyThread: return(new AnyBackgroundMessageQueueThread(spec.Name, handler)); default: throw new InvalidOperationException( Invariant($"Unknown thread type '{spec.Kind}' with name '{spec.Name}'.")); } }
private ReactQueueConfigurationSpec( MessageQueueThreadSpec nativeModulesQueueThreadSpec, MessageQueueThreadSpec jsQueueThreadSpec) { NativeModulesQueueThreadSpec = nativeModulesQueueThreadSpec; JSQueueThreadSpec = jsQueueThreadSpec; }
private static ReactQueueConfigurationSpec CreateDefault() { return(new Builder() { JSQueueThreadSpec = MessageQueueThreadSpec.Create("js", MessageQueueThreadKind.BackgroundSingleThread), NativeModulesQueueThreadSpec = MessageQueueThreadSpec.Create("native_modules", MessageQueueThreadKind.BackgroundAnyThread), } .Build()); }
/// <summary> /// Factory to create the action queue. /// </summary> /// <param name="spec">The action queue specification.</param> /// <param name="handler">The exception handler.</param> /// <returns>The action queue instance.</returns> public static MessageQueueThread Create( MessageQueueThreadSpec spec, Action<Exception> handler) { if (spec == null) throw new ArgumentNullException(nameof(spec)); if (handler == null) throw new ArgumentNullException(nameof(handler)); switch (spec.Kind) { case MessageQueueThreadKind.DispatcherThread: return new DispatcherMessageQueueThread(spec.Name, handler); case MessageQueueThreadKind.BackgroundSingleThread: return new SingleBackgroundMessageQueueThread(spec.Name, handler); case MessageQueueThreadKind.BackgroundAnyThread: return new AnyBackgroundMessageQueueThread(spec.Name, handler); default: throw new InvalidOperationException( Invariant($"Unknown thread type '{spec.Kind}' with name '{spec.Name}'.")); } }