Behavior of Thread::new() on passed instances
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- C
- Estrellas
- 49
- Forks
- 31
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
The original implementation (see also #38) is designed so that Thread.new(a) makes a full copy of a in the newly created thread (unless mrb_type(a) == MRB_TT_DATA).
As a consequence, changes to a in any given thread are not visible to the other threads. This way, passing information between threads becomes a hard task.
Since I am still not sure about the reasons behind this choice, I have made an experimental branch in my own fork (pbosetti/mruby-thread) where the C macro MRB_THREAD_COPY_VALUES can be set to enable the original behavior (make copies) or leave undefined to switch to a "share the same instances" behavior.
The script examples/data.rb can be used to compare the two cases: when MRB_THREAD_COPY_VALUES is set, the changes to globals $data and $ary made in the subthread are not visible into the main thread. Conversely, if MRB_THREAD_COPY_VALUES, any change to instances passed to Thread::new() are visible to other threads.
The question is: can I make a PR for this?
Thanks,
Paolo
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza leyendo la implementación original referenciada en #38 y la rama experimental pbosetti/mruby-thread. Compara los dos comportamientos de MRB_THREAD_COPY_VALUES usando examples/data.rb y determina después si las instancias compartidas son un diseño aceptado y qué pruebas o documentación definirían el comportamiento previsto de Thread::new.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- c
- Área
- operating-systems
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100