You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a type T implements Sync, it indicates to the compiler that something of this type has no possibility of introducing memory unsafety when used from multiple threads concurrently.
The term "used" should be elaborated: "when used by immutable reference from ..."
It will not occur to a reader that a primitive type implements Sync.
For example, sharing immutable data with an atomic reference count is threadsafe. Rust provides a type like this, Arc<T>, and it implements Sync, so it is safe to share between threads.
This might leave an impression that usize does not implement Sync but when wrapped with Arc, Arc<usize> will have Sync!! (This really was my impression until recently!).
Besides, saying Arc<T> implements Sync itself is incorrect -- it should say "Arc<T> implements Sync if and only if T implements Sync", or better, don't mention Arc at all...
Please word this section more carefully, so that confusion is eliminated in future...
Ref: section 4.6
The text was updated successfully, but these errors were encountered:
The term "used" should be elaborated: "when used by immutable reference from ..."
It will not occur to a reader that a primitive type implements
Sync
.This might leave an impression that
usize
does not implementSync
but when wrapped withArc
,Arc<usize>
will haveSync
!! (This really was my impression until recently!).Besides, saying
Arc<T>
implementsSync
itself is incorrect -- it should say "Arc<T>
implementsSync
if and only ifT
implementsSync
", or better, don't mentionArc
at all...Please word this section more carefully, so that confusion is eliminated in future...
Ref: section 4.6
The text was updated successfully, but these errors were encountered: