From owner-svn-src-all@freebsd.org Tue Sep 8 08:48:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57AFBA00953; Tue, 8 Sep 2015 08:48:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CC571205; Tue, 8 Sep 2015 08:48:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t888msWV082653; Tue, 8 Sep 2015 08:48:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t888ms8X082652; Tue, 8 Sep 2015 08:48:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509080848.t888ms8X082652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 8 Sep 2015 08:48:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r287557 - head/lib/libthr/thread X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Sep 2015 08:48:54 -0000 Author: kib Date: Tue Sep 8 08:48:53 2015 New Revision: 287557 URL: https://svnweb.freebsd.org/changeset/base/287557 Log: Style. Use ANSI definition, wrap long lines, no initialization in declaration for locals. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libthr/thread/thr_once.c Modified: head/lib/libthr/thread/thr_once.c ============================================================================== --- head/lib/libthr/thread/thr_once.c Tue Sep 8 08:41:07 2015 (r287556) +++ head/lib/libthr/thread/thr_once.c Tue Sep 8 08:48:53 2015 (r287557) @@ -50,9 +50,11 @@ __weak_reference(_pthread_once, pthread_ static void once_cancel_handler(void *arg) { - pthread_once_t *once_control = arg; + pthread_once_t *once_control; - if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, ONCE_NEVER_DONE)) + once_control = arg; + if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, + ONCE_NEVER_DONE)) return; atomic_store_rel_int(&once_control->state, ONCE_NEVER_DONE); _thr_umtx_wake(&once_control->state, INT_MAX, 0); @@ -73,13 +75,17 @@ _pthread_once(pthread_once_t *once_contr return (0); } if (state == ONCE_NEVER_DONE) { - if (atomic_cmpset_int(&once_control->state, state, ONCE_IN_PROGRESS)) + if (atomic_cmpset_int(&once_control->state, state, + ONCE_IN_PROGRESS)) break; } else if (state == ONCE_IN_PROGRESS) { - if (atomic_cmpset_int(&once_control->state, state, ONCE_WAIT)) - _thr_umtx_wait_uint(&once_control->state, ONCE_WAIT, NULL, 0); + if (atomic_cmpset_int(&once_control->state, state, + ONCE_WAIT)) + _thr_umtx_wait_uint(&once_control->state, + ONCE_WAIT, NULL, 0); } else if (state == ONCE_WAIT) { - _thr_umtx_wait_uint(&once_control->state, state, NULL, 0); + _thr_umtx_wait_uint(&once_control->state, state, + NULL, 0); } else return (EINVAL); } @@ -88,7 +94,8 @@ _pthread_once(pthread_once_t *once_contr THR_CLEANUP_PUSH(curthread, once_cancel_handler, once_control); init_routine(); THR_CLEANUP_POP(curthread, 0); - if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, ONCE_DONE)) + if (atomic_cmpset_rel_int(&once_control->state, ONCE_IN_PROGRESS, + ONCE_DONE)) return (0); atomic_store_rel_int(&once_control->state, ONCE_DONE); _thr_umtx_wake(&once_control->state, INT_MAX, 0); @@ -96,6 +103,6 @@ _pthread_once(pthread_once_t *once_contr } void -_thr_once_init() +_thr_once_init(void) { }