Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserve order in ThreadGroup#list.
This is a squashed commit of the following changes for #2221. Thanks to @godfat for the work on this one. commit 4bc9e8e Author: Lin Jen-Shin <email@example.com> Date: Fri Dec 19 04:13:20 2014 +0800 WeakIdentityLinkedHashMap: Properly set head. commit fe56e69 Author: Lin Jen-Shin <firstname.lastname@example.org> Date: Fri Dec 19 02:10:43 2014 +0800 Use WeakIdentityLinkedHashSet for RubyThreadGroup: We extend WeakIdentityHashMap for WeakIdentityLinkedHashMap, and use it for WeakIdentityLinkedHashSet. Sorry that this was a naive implementation and I didn't write any tests for this. Originally I want to do something like java.util.LinkedHashMap, but it seems WeakIdentityHashMap didn't implement every thing we need to do the same. Therefore I decided to just write what we need for RubyThreadGroup. We could complete this in the future. Note that this should also fix a bug where WeakIdentityHashMap#valueRemoved is not called properly. commit e5bcad9 Author: Lin Jen-Shin <email@example.com> Date: Tue Nov 25 00:43:53 2014 +0800 Use a ReferenceQueue to sweep dead references commit 475746f Author: Lin Jen-Shin <firstname.lastname@example.org> Date: Fri Nov 21 08:06:39 2014 +0800 Preserve ThreadGroup#list order with ArrayList Because MRI uses a linked list which preserves the order of the threads. https://github.com/ruby/ruby/blob/2a754a733045da9965e88d1f31e650ea6b3f2b6c/vm_core.h#L973-L978 This is useful to assume the first thread in the list is the root of a group, and saving values in the thread could be shared amongst the thread group. If we ever have thread group local variable, this is not really needed.
- Loading branch information
Showing with 121 additions and 13 deletions.