From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS60729 185.220.102.0/24 X-Spam-Status: No, score=-2.2 required=3.0 tests=AWL,BAYES_00, RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_XBL,RDNS_NONE,SPF_FAIL,SPF_HELO_FAIL shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from 80x24.org (unknown [185.220.102.7]) by dcvr.yhbt.net (Postfix) with ESMTP id 8B8F51F405 for ; Fri, 21 Dec 2018 22:34:24 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH] thread_sync (rb_mutex_t): eliminate fork_gen Date: Fri, 21 Dec 2018 22:34:22 +0000 Message-Id: <20181221223422.9219-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: --- thread_sync.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/thread_sync.c b/thread_sync.c index dda92f196a..cf5616080b 100644 --- a/thread_sync.c +++ b/thread_sync.c @@ -45,17 +45,6 @@ typedef struct rb_mutex_struct { rb_thread_t *th; struct rb_mutex_struct *next_mutex; struct list_head waitq; /* protected by GVL */ - - /* - * FIXME: belt-and-suspenders redundancy. This field should NOT - * be necessary at all if: - * - rb_mutex_cleanup_keeping_mutexes - * - rb_mutex_abandon_keeping_mutexes - * - rb_mutex_abandon_locking_mutex - * are all correct, but I suspect one of them is buggy. - * [Bug #15383] [Bug #15430] - */ - rb_serial_t fork_gen; } rb_mutex_t; #if defined(HAVE_WORKING_FORK) @@ -132,17 +121,9 @@ static rb_mutex_t * mutex_ptr(VALUE obj) { rb_mutex_t *mutex; - rb_serial_t fork_gen = GET_VM()->fork_gen; TypedData_Get_Struct(obj, rb_mutex_t, &mutex_data_type, mutex); - /* FIXME: remove (see comment at rb_mutex_t definition) */ - if (mutex->fork_gen != fork_gen) { - /* forked children can't reach into parent thread stacks */ - mutex->fork_gen = fork_gen; - list_head_init(&mutex->waitq); - } - return mutex; } @@ -428,8 +409,7 @@ rb_mutex_abandon_locking_mutex(rb_thread_t *th) if (th->locking_mutex) { rb_mutex_t *mutex = mutex_ptr(th->locking_mutex); - if (mutex->th == th) - rb_mutex_abandon_all(mutex); + list_head_init(&mutex->waitq); th->locking_mutex = Qfalse; } } @@ -455,16 +435,6 @@ rb_mutex_abandon_all(rb_mutex_t *mutexes) static void rb_mutex_cleanup_keeping_mutexes(const rb_thread_t *current_thread) { - rb_mutex_t *mutex = current_thread->keeping_mutexes; - rb_serial_t fork_gen = current_thread->vm->fork_gen; - - while (mutex) { - /* FIXME: remove (see comment at rb_mutex_t definition) */ - mutex->fork_gen = fork_gen; - - list_head_init(&mutex->waitq); - mutex = mutex->next_mutex; - } } #endif -- EW