From: Sylvain Joyeux Date: 2007-03-15T01:19:04+09:00 Subject: Re: [PATCH] grave bug in 1.8.6's thread implementation --Boundary-00=_1BC+Fp80P4dtcz0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline > > The fix is in thread-mutex-remove_one.diff. > > Perhaps you attached the wrong file? This looks like a variation on the > not_owner patch. Yup. Here is the right one. I now have problems with ConditionVariable#wait complaining that the mutex is not owned while it is ... Trying to fix that now. Sylvain --Boundary-00=_1BC+Fp80P4dtcz0 Content-Type: text/x-diff; charset="utf-8"; name="thread-mutex-remove_one.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="thread-mutex-remove_one.diff" --- /home/sjoyeux/system/ruby-1.8.6/ext/thread/thread.c 2007-03-03 11:08:06.000000000 +0100 +++ thread.c 2007-03-14 17:12:38.000000000 +0100 @@ -165,12 +165,23 @@ remove_one(List *list, VALUE value) Entry **ref; Entry *entry; - for (ref = &list->entries, entry = list->entries; - entry != NULL; - ref = &entry->next, entry = entry->next) { - if (entry->value == value) { - *ref = entry->next; - recycle_entries(list, entry, entry); + entry = list->entries; + if (!entry) return; + if (entry->value == value) + { + shift_list(list); + return; + } + + for (entry = list->entries; entry->next != NULL; entry = entry->next) { + Entry* next_entry = entry->next; + if (next_entry->value == value) { + entry->next = next_entry->next; + if (!entry->next) + list->last_entry = entry; + + --list->size; + recycle_entries(list, next_entry, next_entry); break; } } --Boundary-00=_1BC+Fp80P4dtcz0--