Skip to content

Instantly share code, notes, and snippets.

@lizixroy
Created September 4, 2016 20:00
Show Gist options
  • Select an option

  • Save lizixroy/358afd2a78c1141f13426e76cf27e908 to your computer and use it in GitHub Desktop.

Select an option

Save lizixroy/358afd2a78c1141f13426e76cf27e908 to your computer and use it in GitHub Desktop.
RxSwift-article-10.swift
func on(event: Event<E>) {
switch event {
case .Next:
if _isStopped == 0 {
onCore(event)
}
case .Error, .Completed:
if !AtomicCompareAndSwap(0, 1, &_isStopped) {
return
}
onCore(event)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment