 /// A disposable that will optionally dispose of another disposable.
 public final class SerialDisposable: Disposable {
 	private struct State {
-		var innerDisposable: Disposable? = nil
-		var disposed = false
-	}
-
-	private var state = Atomic(State())
+		let innerDisposable: Disposable?
+		let disposed: Bool
+
+		func withDisposable(replacement: Disposable?) -> State {
+			return State(innerDisposable: replacement, disposed: disposed)
+		}
+	}
+
+	private let state = Atomic(State(innerDisposable: nil, disposed: false))
 
 	public var disposed: Bool {
 		return state.value.disposed


/// A disposable that will run an action upon disposal.
public final class ActionDisposable: Disposable {
	private var action: Atomic<(() -> ())?>

	public var disposed: Bool {
		return action.value == nil

/// A disposable that only flips `disposed` upon disposal, and performs no other
/// work.
public final class SimpleDisposable: Disposable {
	private let _disposed = Atomic(false)

	public var disposed: Bool {
		return _disposed.value
