Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jan 2016 22:34:55 +0000 (UTC)
From:      Eric van Gyzen <vangyzen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r293858 - head/lib/libthr/thread
Message-ID:  <201601132234.u0DMYt8L033002@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: vangyzen
Date: Wed Jan 13 22:34:55 2016
New Revision: 293858
URL: https://svnweb.freebsd.org/changeset/base/293858

Log:
  libthr: const-ify two variables
  
  Make the default umutex and urwlock initializers const,
  because they can be, and as a microoptimization.
  
  MFC after:	5 days
  Sponsored by:	Dell Inc.

Modified:
  head/lib/libthr/thread/thr_umtx.c

Modified: head/lib/libthr/thread/thr_umtx.c
==============================================================================
--- head/lib/libthr/thread/thr_umtx.c	Wed Jan 13 21:56:48 2016	(r293857)
+++ head/lib/libthr/thread/thr_umtx.c	Wed Jan 13 22:34:55 2016	(r293858)
@@ -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?201601132234.u0DMYt8L033002>