Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upRFC: Rename Share to Threadsafe #123
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
schmee
commented
Jun 16, 2014
|
Allow me to commence the bikeshedding: I propose the name |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Most of the time, ‘thread-safe’ is written with a hyphen or a space, and so should be counted as two words. That would make this trait I personally don’t like the name Another option would be to just use the word ‘aliasable’ to refer to @schmee |
This comment has been minimized.
This comment has been minimized.
|
Sync +1 |
This comment has been minimized.
This comment has been minimized.
Valloric
commented
Jun 17, 2014
|
You can't call it |
This comment has been minimized.
This comment has been minimized.
|
I like the succinctness of When I think of "sync" I think of "synchronized" which often refers to blocking threads or coordinating to wait for an event to happen. This trait implies that a type is sharable among many threads which at its bare minimum means that appropriate atomic operations are used. These two concepts seem similar, but distinct. For example, I would not think of an That being said, I think the drawbacks of |
This comment has been minimized.
This comment has been minimized.
schmee
commented
Jun 18, 2014
|
Based on your arguments above, I think that EDIT: this also has a nice likeness with atoms in Clojure, which are used to "...provide a way to manage shared, synchronous, independent state". |
This comment has been minimized.
This comment has been minimized.
bill-myers
commented
Jun 18, 2014
|
Threadsafe and Thread have the issue that they would become the most prominent use of the word "thread", which is otherwise not used much since Rust is based on tasks, and they are slightly wrong since the issue is task-safety and not thread-safety (although they are usually equivalent). "Tasksafe" would fix that, but is not a widely used term. Atomic is problematic since it usually implies that atomic CPU instructions or similar mechanisms are being used. Atom is problematic since it is usually either a synonym of Atomic or refers to an interned string type, or to terminal symbols in parsing, or in general to an immutable primitive-valued constant. Sync and Synchronized are problematic because they usually imply that a synchronization primitive is being used. Parallel is problematic because it usually implies that the compiler or library is making some effort to parallelize computation using the type, or that the type is a parallelizable variant of a data structure available in non-parallelizable versions too. DataRaceFree is multi-word and vague. ConcurrentlySharable is too long. This leaves Concurrent (a bit long, maybe a bit vague), Share (a bit vague), Threadsafe (slightly incorrect and a bit long) or Tasksafe (unusual). |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
Perhaps rename share is a mistake?
|
This comment has been minimized.
This comment has been minimized.
|
+1 for |
This comment has been minimized.
This comment has been minimized.
DaGenix
commented
Jun 19, 2014
|
I like |
This comment has been minimized.
This comment has been minimized.
|
EDIT: I made a dumb comment. It is below for reference. Don't read it.
|
This comment has been minimized.
This comment has been minimized.
dobkeratops
commented
Jun 23, 2014
|
I'm told 'Share' is a bound I would need for closures that are safe for data-parallel iterators. I very much hope immutable closures are a case that can be expressed after closure reform - since immutable means its' threadsafe aswell - but also makes inputs / outputs / side-effects clearer. (immutable is suitable for the data-parallel case, and communicates more information about what code does & doesn't do) |
This comment has been minimized.
This comment has been minimized.
NawfelBgh
commented
Jun 24, 2014
|
+1 for Share |
This comment has been minimized.
This comment has been minimized.
anasazi
commented
Jun 30, 2014
|
What about using |
This comment has been minimized.
This comment has been minimized.
flaper87
commented
Jul 11, 2014
|
For the sake of bikeshedding, I'd prefer to keep built-in traits a 1-word long. I think |
This comment has been minimized.
This comment has been minimized.
|
As discussed in today's meeting I have updated the name to |
This comment has been minimized.
This comment has been minimized.
netvl
commented
Jul 23, 2014
|
At first I thought that
However, I don't understand why the documentation states that "there is no possibility of data races when passing &T references between tasks", that is, how it is possible to pass any reference between tasks at all? As far as I understand (and I tripped over this several times) no reference other than Probably if the documentation on |
This comment has been minimized.
This comment has been minimized.
|
There's no safe way to pass This behaviour is designed to allow fork-join/data-parallelism libraries to expose safe and performant interfaces (even if they have to use /// call `func` on each element of `data` in its own task, blocking until
/// all tasks complete.
fn par_apply<T: Share>(data: &[T], func: fn(&T)) {
// (raw function pointer until the nicer closures work)
unsafe { ... }
}This function is safe because each |
This comment has been minimized.
This comment has been minimized.
netvl
commented
Jul 23, 2014
|
So |
This comment has been minimized.
This comment has been minimized.
No, that's not what That is, the (Just to be clear, I'm not arguing in favour of any name, just clearing misconceptions.) |
This comment has been minimized.
This comment has been minimized.
netvl
commented
Jul 23, 2014
|
Thanks for thorough explanation. The situation you're describing is not really obvious from
I was speaking from implementation's point of view, of course, that is, I meant that it is possible to actually use
Yeah, I probably should have expressed myself better. What I meant is that |
This comment has been minimized.
This comment has been minimized.
bjadamson
commented on eb55eea
Jul 24, 2014
|
I wonder if tying the type to the concept of a 'thread' is a good idea, there could be a need for a different context in which access needs some form of managed access in the future. I think 'Synchronized' is more general, and maybe a better name. |
This comment has been minimized.
This comment has been minimized.
Tobba
commented
Jul 30, 2014
|
In my opinion Concurrent is the most suitable name, Sync is a bit too short and implies that the object is actually synchronized, which it doesn't necessarily have to be to be safe |
alexcrichton commentedJun 16, 2014
No description provided.