From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS35366 81.89.96.0/20 X-Spam-Status: No, score=-1.5 required=3.0 tests=BAYES_00,RCVD_IN_XBL shortcircuit=no autolearn=no version=3.3.2 X-Original-To: spew@80x24.org Received: from 80x24.org (luxemburg.gtor.org [81.89.96.89]) by dcvr.yhbt.net (Postfix) with ESMTP id 41B8163633C for ; Fri, 17 Jul 2015 00:58:18 +0000 (UTC) From: Eric Wong To: spew@80x24.org Subject: [PATCH] thread.c (rb_thread_alone): simplify Date: Fri, 17 Jul 2015 00:58:15 +0000 Message-Id: <1437094695-28816-1-git-send-email-e@80x24.org> List-Id: This function now also works in more places if ruby_current_thread is unset. --- thread.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/thread.c b/thread.c index 1e16eb1..1d550ef 100644 --- a/thread.c +++ b/thread.c @@ -3048,12 +3048,7 @@ vm_living_thread_num(rb_vm_t *vm) int rb_thread_alone(void) { - int num = 1; - if (!list_empty(&GET_THREAD()->vm->living_threads)) { - num = vm_living_thread_num(GET_THREAD()->vm); - thread_debug("rb_thread_alone: %d\n", num); - } - return num == 1; + return vm_living_thread_num(GET_VM()) == 1; } /* -- EW