/// <summary> /// Does the same as Subscribe but will marshal the action over to the given MarshalableThread /// </summary> /// <typeparam name="T"></typeparam> /// <param name="thread"></param> /// <param name="action"></param> public void SubscribeOn <T>(MarshalableThread thread, Action <T> action) { var targets = _channels.GetOrAdd(typeof(T), t => new ConcurrentQueue <InvocationTarget>()); targets.Enqueue(new InvocationTarget(obj => action((T)obj), thread)); }
public InvocationTarget(Action <object> action, MarshalableThread marshalableThread) { _action = action; _marshalableThread = marshalableThread; }