Arc
Atomic Reference Counting
Arc<Mutex<T>>
If we pair Arc with Mutex, we finally get a type that:
Can be sent between threads, because:
Arc is Send if T is Send, and
Mutex is Send if T is Send.
T is Ticket, which is Send.
Can be cloned, because Arc is Clone no matter what T is. Cloning an Arc increments the reference count, the data is not copied.
Can be used to modify the data it wraps, because Arc lets you get a shared reference to Mutex<T> which can in turn be used to acquire a lock.
Mutex は clone じゃなかったから channel 経由で送信できなかった
けど Arc は clone、T (ここでは Mutex<...>) への reference を返して count を increment
Mutex は interior mutability ってやつで 変更可能