Date: Sat, 23 Jan 2016 20:51:57 +0000 (UTC) From: Eric van Gyzen <vangyzen@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r294640 - stable/9/lib/libthr/thread Message-ID: <201601232051.u0NKpvee054141@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: vangyzen Date: Sat Jan 23 20:51:57 2016 New Revision: 294640 URL: https://svnweb.freebsd.org/changeset/base/294640 Log: MFC r293858 libthr: const-ify two variables Make the default umutex and urwlock initializers const, because they can be, and as a microoptimization. Sponsored by: Dell Inc. Modified: stable/9/lib/libthr/thread/thr_umtx.c Directory Properties: stable/9/lib/libthr/ (props changed) Modified: stable/9/lib/libthr/thread/thr_umtx.c ============================================================================== --- stable/9/lib/libthr/thread/thr_umtx.c Sat Jan 23 20:49:52 2016 (r294639) +++ stable/9/lib/libthr/thread/thr_umtx.c Sat Jan 23 20:51:57 2016 (r294640) @@ -42,7 +42,7 @@ int _umtx_op_err(void *obj, int op, u_lo void _thr_umutex_init(struct umutex *mtx) { - static struct umutex default_mtx = DEFAULT_UMUTEX; + static const struct umutex default_mtx = DEFAULT_UMUTEX; *mtx = default_mtx; } @@ -50,7 +50,8 @@ _thr_umutex_init(struct umutex *mtx) void _thr_urwlock_init(struct urwlock *rwl) { - static struct urwlock default_rwl = DEFAULT_URWLOCK; + static const struct urwlock default_rwl = DEFAULT_URWLOCK; + *rwl = default_rwl; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201601232051.u0NKpvee054141>